@prismicio/svelte 1.2.0 → 1.3.0-alpha.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.
@@ -1,5 +1,6 @@
1
1
  <script>import {
2
- asLinkAttrs
2
+ asLinkAttrs,
3
+ isFilled
3
4
  } from "@prismicio/client";
4
5
  export let field = void 0;
5
6
  export let document = void 0;
@@ -10,6 +11,8 @@ $:
10
11
  });
11
12
  $:
12
13
  resolvedRel = typeof rel === "string" ? rel : linkAttrs.rel;
14
+ $:
15
+ resolvedText = field?.text;
13
16
  </script>
14
17
 
15
18
  <!--
@@ -18,9 +21,7 @@ $:
18
21
 
19
22
  @example Rendering a Link field:
20
23
  ```svelte
21
- <PrismicLink field={document.data.example_link}>
22
- Example anchor text.
23
- </PrismicLink>
24
+ <PrismicLink field={document.data.example_link} />
24
25
  ```
25
26
  -->
26
27
 
@@ -31,5 +32,5 @@ $:
31
32
  on:click
32
33
  {...$$restProps}
33
34
  >
34
- <slot />
35
+ <slot>{resolvedText}</slot>
35
36
  </a>
@@ -40,9 +40,7 @@ export type PrismicLinkSlots = typeof __propDef.slots;
40
40
  *
41
41
  * @example Rendering a Link field:
42
42
  * ```svelte
43
- * <PrismicLink field={document.data.example_link}>
44
- * Example anchor text.
45
- * </PrismicLink>
43
+ * <PrismicLink field={document.data.example_link} />
46
44
  * ```
47
45
  */
48
46
  export default class PrismicLink extends SvelteComponent<PrismicLinkProps, PrismicLinkEvents, PrismicLinkSlots> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/svelte",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-alpha.0",
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.4.0",
69
- "@prismicio/mock": "^0.3.1",
68
+ "@prismicio/client": "7.9.0-alpha.3",
69
+ "@prismicio/mock": "0.3.8-alpha.2",
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,5 +106,9 @@
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"
109
113
  }
110
114
  }
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import {
3
3
  asLinkAttrs,
4
+ isFilled,
4
5
  type AsLinkAttrsConfig,
5
6
  type LinkField,
6
7
  type PrismicDocument,
@@ -41,6 +42,7 @@
41
42
  });
42
43
 
43
44
  $: resolvedRel = typeof rel === "string" ? rel : linkAttrs.rel;
45
+ $: resolvedText = field?.text;
44
46
  </script>
45
47
 
46
48
  <!--
@@ -49,9 +51,7 @@
49
51
 
50
52
  @example Rendering a Link field:
51
53
  ```svelte
52
- <PrismicLink field={document.data.example_link}>
53
- Example anchor text.
54
- </PrismicLink>
54
+ <PrismicLink field={document.data.example_link} />
55
55
  ```
56
56
  -->
57
57
 
@@ -62,5 +62,5 @@
62
62
  on:click
63
63
  {...$$restProps}
64
64
  >
65
- <slot />
65
+ <slot>{resolvedText}</slot>
66
66
  </a>