@prismicio/svelte 1.3.0-alpha.0 → 1.3.1

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.
@@ -1,6 +1,5 @@
1
1
  <script>import {
2
- asLinkAttrs,
3
- isFilled
2
+ asLinkAttrs
4
3
  } from "@prismicio/client";
5
4
  export let field = void 0;
6
5
  export let document = void 0;
@@ -11,8 +10,6 @@ $:
11
10
  });
12
11
  $:
13
12
  resolvedRel = typeof rel === "string" ? rel : linkAttrs.rel;
14
- $:
15
- resolvedText = field?.text;
16
13
  </script>
17
14
 
18
15
  <!--
@@ -32,5 +29,5 @@ $:
32
29
  on:click
33
30
  {...$$restProps}
34
31
  >
35
- <slot>{resolvedText}</slot>
32
+ <slot>{field?.text}</slot>
36
33
  </a>
@@ -2,22 +2,24 @@
2
2
  import PrismicImage from "../PrismicImage.svelte";
3
3
  import PrismicLink from "../PrismicLink.svelte";
4
4
  export let node;
5
+ $:
6
+ dir = "direction" in node && node.direction === "rtl" ? "rtl" : void 0;
5
7
  </script>
6
8
 
7
9
  {#if node.type === "heading1"}
8
- <h1><slot /></h1>
10
+ <h1 {dir}><slot /></h1>
9
11
  {:else if node.type === "heading2"}
10
- <h2><slot /></h2>
12
+ <h2 {dir}><slot /></h2>
11
13
  {:else if node.type === "heading3"}
12
- <h3><slot /></h3>
14
+ <h3 {dir}><slot /></h3>
13
15
  {:else if node.type === "heading4"}
14
- <h4><slot /></h4>
16
+ <h4 {dir}><slot /></h4>
15
17
  {:else if node.type === "heading5"}
16
- <h5><slot /></h5>
18
+ <h5 {dir}><slot /></h5>
17
19
  {:else if node.type === "heading6"}
18
- <h6><slot /></h6>
20
+ <h6 {dir}><slot /></h6>
19
21
  {:else if node.type === "paragraph"}
20
- <p><slot /></p>
22
+ <p {dir}><slot /></p>
21
23
  {:else if node.type === "preformatted"}
22
24
  <pre><slot /></pre>
23
25
  {:else if node.type === "strong"}
@@ -25,9 +27,9 @@ export let node;
25
27
  {:else if node.type === "em"}
26
28
  <em><slot /></em>
27
29
  {:else if node.type === "list-item"}
28
- <li><slot /></li>
30
+ <li {dir}><slot /></li>
29
31
  {:else if node.type === "o-list-item"}
30
- <li><slot /></li>
32
+ <li {dir}><slot /></li>
31
33
  {:else if node.type === "group-list-item"}
32
34
  <ul><slot /></ul>
33
35
  {:else if node.type === "group-o-list-item"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/svelte",
3
- "version": "1.3.0-alpha.0",
3
+ "version": "1.3.1",
4
4
  "description": "Svelte components to present Prismic content.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -65,8 +65,8 @@
65
65
  "esm-env": "^1.0.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@prismicio/client": "7.9.0-alpha.3",
69
- "@prismicio/mock": "0.3.8-alpha.2",
68
+ "@prismicio/client": "^7.11.0",
69
+ "@prismicio/mock": "^0.4.0",
70
70
  "@size-limit/preset-small-lib": "^11.0.1",
71
71
  "@sveltejs/kit": "^2.0.0",
72
72
  "@sveltejs/package": "^2.2.3",
@@ -106,9 +106,5 @@
106
106
  },
107
107
  "publishConfig": {
108
108
  "access": "public"
109
- },
110
- "overrides": {
111
- "@prismicio/client": "7.9.0-alpha.3",
112
- "@prismicio/mock": "0.3.8-alpha.2"
113
109
  }
114
110
  }
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import {
3
3
  asLinkAttrs,
4
- isFilled,
5
4
  type AsLinkAttrsConfig,
6
5
  type LinkField,
7
6
  type PrismicDocument,
@@ -42,7 +41,6 @@
42
41
  });
43
42
 
44
43
  $: resolvedRel = typeof rel === "string" ? rel : linkAttrs.rel;
45
- $: resolvedText = field?.text;
46
44
  </script>
47
45
 
48
46
  <!--
@@ -62,5 +60,5 @@
62
60
  on:click
63
61
  {...$$restProps}
64
62
  >
65
- <slot>{resolvedText}</slot>
63
+ <slot>{field?.text}</slot>
66
64
  </a>
@@ -6,22 +6,24 @@
6
6
  import PrismicLink from "../PrismicLink.svelte";
7
7
 
8
8
  export let node: RTAnyNode;
9
+
10
+ $: dir = "direction" in node && node.direction === "rtl" ? "rtl" : undefined
9
11
  </script>
10
12
 
11
13
  {#if node.type === "heading1"}
12
- <h1><slot /></h1>
14
+ <h1 {dir}><slot /></h1>
13
15
  {:else if node.type === "heading2"}
14
- <h2><slot /></h2>
16
+ <h2 {dir}><slot /></h2>
15
17
  {:else if node.type === "heading3"}
16
- <h3><slot /></h3>
18
+ <h3 {dir}><slot /></h3>
17
19
  {:else if node.type === "heading4"}
18
- <h4><slot /></h4>
20
+ <h4 {dir}><slot /></h4>
19
21
  {:else if node.type === "heading5"}
20
- <h5><slot /></h5>
22
+ <h5 {dir}><slot /></h5>
21
23
  {:else if node.type === "heading6"}
22
- <h6><slot /></h6>
24
+ <h6 {dir}><slot /></h6>
23
25
  {:else if node.type === "paragraph"}
24
- <p><slot /></p>
26
+ <p {dir}><slot /></p>
25
27
  {:else if node.type === "preformatted"}
26
28
  <pre><slot /></pre>
27
29
  {:else if node.type === "strong"}
@@ -29,9 +31,9 @@
29
31
  {:else if node.type === "em"}
30
32
  <em><slot /></em>
31
33
  {:else if node.type === "list-item"}
32
- <li><slot /></li>
34
+ <li {dir}><slot /></li>
33
35
  {:else if node.type === "o-list-item"}
34
- <li><slot /></li>
36
+ <li {dir}><slot /></li>
35
37
  {:else if node.type === "group-list-item"}
36
38
  <ul><slot /></ul>
37
39
  {:else if node.type === "group-o-list-item"}