@prismicio/svelte 0.0.9 → 0.0.11
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.
|
@@ -6,8 +6,10 @@ import Serialize from "./Serialize.svelte";
|
|
|
6
6
|
export let field = [];
|
|
7
7
|
export let linkResolver = void 0;
|
|
8
8
|
export let components = void 0;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
$:
|
|
10
|
+
resolvedSerializer = typeof components === "object" ? wrapMapSerializer(components) : components;
|
|
11
|
+
$:
|
|
12
|
+
nodes = asTree(field).children;
|
|
11
13
|
</script>
|
|
12
14
|
|
|
13
15
|
<!--
|
|
@@ -16,21 +16,18 @@ declare const __propDef: {
|
|
|
16
16
|
* @see Learn about Link Resolvers and Route Resolvers {@link https://prismic.io/docs/route-resolver}
|
|
17
17
|
*/ linkResolver?: LinkResolverFunction | undefined;
|
|
18
18
|
/**
|
|
19
|
-
* An object that maps Rich Text blocks to
|
|
19
|
+
* An object that maps Rich Text blocks to Svelte components.
|
|
20
20
|
*
|
|
21
21
|
* **Important**: Your components must be wrapped in a function. For example:
|
|
22
22
|
* `{ heading1: () => Heading }`, not: `{ heading1: Heading }`.
|
|
23
23
|
*
|
|
24
|
-
* @example A serializer that modififes `h1`
|
|
24
|
+
* @example A serializer that modififes `h1` elements:
|
|
25
25
|
*
|
|
26
26
|
* ```js
|
|
27
27
|
* import Title from "./Title.svelte";
|
|
28
28
|
*
|
|
29
|
-
* const field = exampleRichText;
|
|
30
|
-
*
|
|
31
29
|
* const richTextSerializer = {
|
|
32
30
|
* h1: () => Title,
|
|
33
|
-
* em: ({ children }) => `<mark>${children}</mark>`,
|
|
34
31
|
* };
|
|
35
32
|
* ```
|
|
36
33
|
*/ components?: RichTextMapSerializer<typeof SvelteComponent, TreeNode> | RichTextFunctionSerializer<typeof SvelteComponent, TreeNode> | undefined;
|
|
@@ -28,21 +28,18 @@
|
|
|
28
28
|
export let linkResolver: LinkResolverFunction | undefined = undefined;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* An object that maps Rich Text blocks to
|
|
31
|
+
* An object that maps Rich Text blocks to Svelte components.
|
|
32
32
|
*
|
|
33
33
|
* **Important**: Your components must be wrapped in a function. For example:
|
|
34
34
|
* `{ heading1: () => Heading }`, not: `{ heading1: Heading }`.
|
|
35
35
|
*
|
|
36
|
-
* @example A serializer that modififes `h1`
|
|
36
|
+
* @example A serializer that modififes `h1` elements:
|
|
37
37
|
*
|
|
38
38
|
* ```js
|
|
39
39
|
* import Title from "./Title.svelte";
|
|
40
40
|
*
|
|
41
|
-
* const field = exampleRichText;
|
|
42
|
-
*
|
|
43
41
|
* const richTextSerializer = {
|
|
44
42
|
* h1: () => Title,
|
|
45
|
-
* em: ({ children }) => `<mark>${children}</mark>`,
|
|
46
43
|
* };
|
|
47
44
|
* ```
|
|
48
45
|
*/
|
|
@@ -51,10 +48,10 @@
|
|
|
51
48
|
| RichTextFunctionSerializer<typeof SvelteComponent, TreeNode>
|
|
52
49
|
| undefined = undefined;
|
|
53
50
|
|
|
54
|
-
|
|
51
|
+
$: resolvedSerializer =
|
|
55
52
|
typeof components === "object" ? wrapMapSerializer(components) : components;
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
$: nodes = asTree(field).children;
|
|
58
55
|
</script>
|
|
59
56
|
|
|
60
57
|
<!--
|