@prismicio/svelte 0.0.4 → 0.0.6
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.
- package/CHANGELOG.md +42 -32
- package/PrismicProvider.svelte +1 -2
- package/components/PrismicEmbed.svelte +8 -4
- package/components/PrismicImage.svelte +9 -16
- package/components/PrismicLink.svelte +20 -39
- package/components/PrismicPreview.svelte +9 -4
- package/components/PrismicText.svelte +1 -1
- package/components/SliceZone.svelte +8 -8
- package/components/TodoSliceComponent.svelte +4 -4
- package/components/index.js +1 -1
- package/index.js +1 -1
- package/{PrismicProvider.svelte.d.ts → lib/PrismicProvider.svelte.d.ts} +3 -3
- package/{components → lib/components}/PrismicEmbed.svelte.d.ts +3 -3
- package/{components → lib/components}/PrismicImage.svelte.d.ts +4 -4
- package/lib/components/PrismicLink.svelte.d.ts +26 -0
- package/{components → lib/components}/PrismicPreview.svelte.d.ts +3 -3
- package/{components → lib/components}/PrismicRichText.svelte.d.ts +3 -3
- package/{components → lib/components}/PrismicText.svelte.d.ts +3 -3
- package/{components → lib/components}/SliceZone.svelte.d.ts +4 -4
- package/{components → lib/components}/TodoSliceComponent.svelte.d.ts +3 -3
- package/lib/components/index.d.ts +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/usePrismic.d.ts +2 -0
- package/package.json +25 -20
- package/src/app.html +2 -2
- package/src/lib/PrismicProvider.svelte +3 -3
- package/src/lib/components/PrismicEmbed.svelte +10 -5
- package/src/lib/components/PrismicImage.svelte +12 -26
- package/src/lib/components/PrismicLink.svelte +39 -54
- package/src/lib/components/PrismicPreview.svelte +24 -19
- package/src/lib/components/PrismicRichText.svelte +7 -7
- package/src/lib/components/PrismicText.svelte +6 -6
- package/src/lib/components/SliceZone.svelte +55 -50
- package/src/lib/components/TodoSliceComponent.svelte +12 -11
- package/src/lib/components/index.ts +1 -1
- package/src/lib/index.ts +1 -1
- package/src/lib/usePrismic.ts +1 -1
- package/src/routes/+page.server.ts +20 -0
- package/src/routes/+page.svelte +35 -0
- package/src/routes/slices/CodeSnippet/index.svelte +19 -0
- package/src/routes/slices/RichText/index.svelte +8 -0
- package/src/routes/slices/index.ts +2 -2
- package/src/types/CodeSnippetSlice.type.ts +7 -0
- package/src/types/ExampleDocument.type.ts +6 -0
- package/src/types/PageDocument.type.ts +7 -0
- package/src/types/PrismicConfig.type.ts +8 -0
- package/src/types/PrismicContext.type.ts +13 -0
- package/src/types/RichTextSlice.type.ts +7 -0
- package/src/types/Route.type.ts +14 -0
- package/src/types/index.ts +7 -0
- package/types/PrismicContext.type.d.ts +7 -0
- package/usePrismic.js +0 -1
- package/components/PrismicLink.svelte.d.ts +0 -29
- package/components/index.d.ts +0 -1
- package/index.d.ts +0 -1
- package/src/lib/types.ts +0 -35
- package/src/routes/index.svelte +0 -26
- package/src/routes/index.ts +0 -15
- package/src/routes/slices/CodeSnippet.svelte +0 -19
- package/src/routes/slices/RichText.svelte +0 -8
- package/types.d.ts +0 -27
- package/types.js +0 -1
- package/usePrismic.d.ts +0 -2
- /package/{configurePrismic.d.ts → lib/configurePrismic.d.ts} +0 -0
- /package/{injectionSymbols.d.ts → lib/injectionSymbols.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,66 +2,76 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [0.0.
|
|
5
|
+
### [0.0.6](https://github.com/prismicio/prismic-svelte/compare/v0.0.5...v0.0.6) (2023-02-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* add `<PrismicLink>` component ([1db9dc0](https://github.com/prismicio/prismic-svelte/commit/1db9dc0cd6a24de87505b5e1486fe9458cb7be01))
|
|
6
11
|
|
|
7
12
|
|
|
8
13
|
### Chore
|
|
9
14
|
|
|
10
|
-
*
|
|
15
|
+
* fix slice typing ([16340b3](https://github.com/prismicio/prismic-svelte/commit/16340b320396f69127e89d26dae498baff8fa299))
|
|
11
16
|
|
|
12
|
-
### [0.0.
|
|
17
|
+
### [0.0.5](https://github.com/prismicio/prismic-svelte/compare/v0.0.4...v0.0.5) (2023-02-23)
|
|
13
18
|
|
|
19
|
+
### Chore
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
- upgrade SvelteKit to 1.0 ([#3](https://github.com/prismicio/prismic-svelte/issues/3)) ([8d5addc](https://github.com/prismicio/prismic-svelte/commit/8d5addcdd669895ccacb666286b57af7825f4869))
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
### [0.0.4](https://github.com/prismicio/prismic-svelte/compare/v0.0.3...v0.0.4) (2022-05-27)
|
|
18
24
|
|
|
25
|
+
### Chore
|
|
19
26
|
|
|
20
|
-
|
|
27
|
+
- Update docs link ([e8d14cf](https://github.com/prismicio/prismic-svelte/commit/e8d14cf66ee9c52d624848dbcabe29a531ecae5e))
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
### [0.0.3](https://github.com/prismicio/prismic-svelte/compare/v0.0.2...v0.0.3) (2022-05-17)
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
- change dev default value to ([11903bc](https://github.com/prismicio/prismic-svelte/commit/11903bc0e11f86e57bdebee3888c8b7efcffac97))
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
23
36
|
|
|
37
|
+
- add experimental disclaimer ([3779ec1](https://github.com/prismicio/prismic-svelte/commit/3779ec199cbcbf5d04bacbf2274cf484c1eec0db))
|
|
24
38
|
|
|
25
39
|
### Chore
|
|
26
40
|
|
|
27
|
-
|
|
41
|
+
- **deps:** maintain lock file ([d7ab62f](https://github.com/prismicio/prismic-svelte/commit/d7ab62f28884c2734ef2ae96b6a2f094ef835211))
|
|
28
42
|
|
|
29
43
|
### [0.0.2](https://github.com/prismicio/prismic-svelte/compare/v0.0.1...v0.0.2) (2022-05-13)
|
|
30
44
|
|
|
31
|
-
|
|
32
45
|
### Chore
|
|
33
46
|
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
- fix release script ([074d4fb](https://github.com/prismicio/prismic-svelte/commit/074d4fbdd6e3a7fd49b2e7fbe6b8a6b7b315491f))
|
|
48
|
+
- fix release script ([026072a](https://github.com/prismicio/prismic-svelte/commit/026072ac3ff6fe08e161ac15c8776767af70f0d3))
|
|
36
49
|
|
|
37
50
|
### 0.0.1 (2022-05-13)
|
|
38
51
|
|
|
39
|
-
|
|
40
52
|
### Features
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
- Change PrismicProvider prop to only Command line to bootstrap prismic projects. ([e4675d4](https://github.com/prismicio/prismic-svelte/commit/e4675d48d4a2d9fe89c04aa4273948ef2a84d018))
|
|
55
|
+
- Finish creating components; Create Slices for route. ([5b18487](https://github.com/prismicio/prismic-svelte/commit/5b1848736dcf5d75e09556a57756017fc46847f4))
|
|
56
|
+
- Get htmlSerializer from context in PrismicRichText ([36664bc](https://github.com/prismicio/prismic-svelte/commit/36664bc72d7e9eb6cd353c96ae22ed209143a905))
|
|
57
|
+
- Handle missing url ([54b3a75](https://github.com/prismicio/prismic-svelte/commit/54b3a7529eda7b29542483a5b7b0ab33c2b22643))
|
|
58
|
+
- Improve mock data ([782a0f0](https://github.com/prismicio/prismic-svelte/commit/782a0f031c41aeefb2d14220146087fc164b6eae))
|
|
59
|
+
- Merge Lucie's and Sam's link components ([3ea6c7f](https://github.com/prismicio/prismic-svelte/commit/3ea6c7fdb48ad718a62f0cf70662fdb79e6e7d96))
|
|
60
|
+
- Rename to ([cc271cb](https://github.com/prismicio/prismic-svelte/commit/cc271cb285089f3bc6104b771711fe62fb3f5fea))
|
|
61
|
+
- revamp slicezone component ([65c55b8](https://github.com/prismicio/prismic-svelte/commit/65c55b84f7c7eea7e65470f6b5a101c7749d2cde))
|
|
62
|
+
- setup link component ([0545d48](https://github.com/prismicio/prismic-svelte/commit/0545d48fcb0413f40e917d1f4857996d5f402e69))
|
|
63
|
+
- setup prismic provider ([9b9752f](https://github.com/prismicio/prismic-svelte/commit/9b9752fce5f4754bc195e83f44a4bb081e203b95))
|
|
64
|
+
- Setup Prismicimage component ([0033cb5](https://github.com/prismicio/prismic-svelte/commit/0033cb515f2444a5f45040d28a27bf05ac7e0dd0))
|
|
54
65
|
|
|
55
66
|
### Bug Fixes
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
- Add shx so commands work cross platform ([1731f64](https://github.com/prismicio/prismic-svelte/commit/1731f64fa9310fdb93cf15b250320e0939d73f8b))
|
|
59
69
|
|
|
60
70
|
### Chore
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
- Add TODOs, rename plaintext component ([691aab7](https://github.com/prismicio/prismic-svelte/commit/691aab7bc9d47d2bdb47024e30ca90301813c85d))
|
|
73
|
+
- init project ([9afa15a](https://github.com/prismicio/prismic-svelte/commit/9afa15a8a4372de8eb5b16e087433d2a640a93a0))
|
|
74
|
+
- maintain repository ([e3ae492](https://github.com/prismicio/prismic-svelte/commit/e3ae492c0c03e121c8bddf03c96065485a448863))
|
|
75
|
+
- migrate to vitest ([bbae453](https://github.com/prismicio/prismic-svelte/commit/bbae45309262b845dde7149ffad938bcc8aabc66))
|
|
76
|
+
- setup todo components ([d57cf26](https://github.com/prismicio/prismic-svelte/commit/d57cf263f5294d9227a43bb9bb82e9e788dca09e))
|
|
77
|
+
- update template config ([93a1b59](https://github.com/prismicio/prismic-svelte/commit/93a1b5971cf796f6eb9433044defc67eccf56bd2))
|
package/PrismicProvider.svelte
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script>import { setContext } from "svelte";
|
|
2
2
|
import { prismicKey } from "./injectionSymbols";
|
|
3
|
-
import "./types";
|
|
4
3
|
// export let client: PrismicContext["client"] = undefined;
|
|
5
4
|
// export let linkResolver: PrismicContext["linkResolver"] = undefined;
|
|
6
5
|
// export let htmlSerializer: PrismicContext["htmlSerializer"] = undefined;
|
|
@@ -15,7 +14,7 @@ setContext(prismicKey, {
|
|
|
15
14
|
client: prismic.client,
|
|
16
15
|
linkResolver: prismic.linkResolver,
|
|
17
16
|
htmlSerializer: prismic.htmlSerializer,
|
|
18
|
-
slices: prismic.slices
|
|
17
|
+
slices: prismic.slices,
|
|
19
18
|
});
|
|
20
19
|
</script>
|
|
21
20
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
+
export let field;
|
|
3
|
+
if (!prismicH.isFilled.embed(field)) {
|
|
4
|
+
console.warn("Invalid prop");
|
|
5
|
+
}
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
|
-
{
|
|
8
|
+
{#if prismicH.isFilled.embed(field)}
|
|
9
|
+
{@html field.html}
|
|
10
|
+
{/if}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
<script>import "@prismicio/
|
|
1
|
+
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
2
|
export let field;
|
|
3
3
|
let className;
|
|
4
|
-
// creates a `class` property, even
|
|
5
|
-
// though it is a reserved word
|
|
6
4
|
export { className as class };
|
|
7
|
-
const usePrismicImage = (field) => {
|
|
8
|
-
field.url;
|
|
9
|
-
return {
|
|
10
|
-
url: field.url || "",
|
|
11
|
-
alt: field.alt || "",
|
|
12
|
-
width: field.dimensions?.width || undefined,
|
|
13
|
-
height: field.dimensions?.height || undefined,
|
|
14
|
-
copyright: field.copyright || undefined,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
const image = usePrismicImage(field);
|
|
18
5
|
</script>
|
|
19
6
|
|
|
20
|
-
{#if field
|
|
21
|
-
|
|
7
|
+
{#if prismicH.isFilled.image(field)}
|
|
8
|
+
{@const { alt, dimensions } = field}
|
|
9
|
+
{@const { width, height } = dimensions}
|
|
10
|
+
{@const { src, srcset } = prismicH.asImageWidthSrcSet(field)}
|
|
11
|
+
|
|
12
|
+
<img {src} {srcset} {alt} {width} {height} class={className} />
|
|
13
|
+
{:else}
|
|
14
|
+
<img alt={field.alt || ""} class={className} />
|
|
22
15
|
{/if}
|
|
@@ -1,44 +1,25 @@
|
|
|
1
1
|
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export let
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
rels.push(...rel?.split(" "));
|
|
10
|
-
if ((field && "target" in field && field?.target === "_blank") ||
|
|
11
|
-
target === "_blank")
|
|
12
|
-
defaultBlankTargetRelAttribute.forEach((item) => {
|
|
13
|
-
if (!rels.includes(item))
|
|
14
|
-
rels.push(item);
|
|
15
|
-
});
|
|
16
|
-
if (field &&
|
|
17
|
-
"link_type" in field &&
|
|
18
|
-
field?.link_type === "Web" &&
|
|
19
|
-
!rels.includes("external"))
|
|
20
|
-
rels.push("external");
|
|
21
|
-
return rels.join(" ");
|
|
22
|
-
};
|
|
23
|
-
const attrs = {
|
|
24
|
-
download,
|
|
25
|
-
hreflang,
|
|
26
|
-
referrerpolicy,
|
|
27
|
-
target: target || field?.target || undefined,
|
|
28
|
-
rel: setRel(),
|
|
29
|
-
type,
|
|
30
|
-
};
|
|
31
|
-
const link = field
|
|
32
|
-
? prismicH.asLink(field, linkResolver || usePrismic().linkResolver)
|
|
33
|
-
: "";
|
|
34
|
-
const href = link || "";
|
|
2
|
+
export let field;
|
|
3
|
+
export let linkResolver = undefined;
|
|
4
|
+
export let target = undefined;
|
|
5
|
+
const resolvedTarget = target || (field && "target" in field && field.target) || undefined;
|
|
6
|
+
export let rel = undefined;
|
|
7
|
+
const resolvedRel = rel || (target === "_blank" ? "noopener noreferrer" : undefined);
|
|
8
|
+
const href = (field ? prismicH.asLink(field, linkResolver) : "") || "";
|
|
35
9
|
</script>
|
|
36
10
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
11
|
+
<!--
|
|
12
|
+
@component
|
|
13
|
+
Component to render a Prismic Link, Link to Media, Content Relationship, or whole Document as an `a` tag.
|
|
14
|
+
|
|
15
|
+
@example Rendering a Link field:
|
|
16
|
+
```svelte
|
|
17
|
+
<PrismicLink field={document.data.example_link}>
|
|
18
|
+
Example anchor text.
|
|
19
|
+
</PrismicLink>
|
|
20
|
+
```
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
<a {href} {...$$restProps} rel={resolvedRel} target={resolvedTarget}>
|
|
43
24
|
<slot />
|
|
44
25
|
</a>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<script>import
|
|
2
|
-
import { goto } from
|
|
1
|
+
<script>import * as prismic from "@prismicio/client";
|
|
2
|
+
import { goto } from "$app/navigation";
|
|
3
3
|
import { onMount } from "svelte";
|
|
4
4
|
export let linkResolver;
|
|
5
5
|
export let defaultURL;
|
|
@@ -9,7 +9,12 @@ onMount(async () => {
|
|
|
9
9
|
const previewToken = urlParams.get("token");
|
|
10
10
|
const documentID = urlParams.get("documentId");
|
|
11
11
|
if (documentID && previewToken) {
|
|
12
|
-
const redirect = await client.resolvePreviewURL({
|
|
12
|
+
const redirect = await client.resolvePreviewURL({
|
|
13
|
+
documentID,
|
|
14
|
+
defaultURL,
|
|
15
|
+
previewToken,
|
|
16
|
+
linkResolver,
|
|
17
|
+
});
|
|
13
18
|
await goto(redirect);
|
|
14
19
|
return;
|
|
15
20
|
}
|
|
@@ -18,4 +23,4 @@ onMount(async () => {
|
|
|
18
23
|
});
|
|
19
24
|
</script>
|
|
20
25
|
|
|
21
|
-
<slot
|
|
26
|
+
<slot />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script>import TodoSliceComponent from
|
|
1
|
+
<script>import TodoSliceComponent from "./TodoSliceComponent.svelte";
|
|
2
2
|
export let slices = [];
|
|
3
3
|
export let components = {};
|
|
4
4
|
export let context = {};
|
|
@@ -7,11 +7,11 @@ export let dev = false;
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
{#each slices as slice, index}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
{@const type = "slice_type" in slice ? slice.slice_type : slice.type}
|
|
11
|
+
{@const Component = components[type] || defaultComponent}
|
|
12
|
+
{#if Component}
|
|
13
|
+
<svelte:component this={Component} {slice} {slices} {context} {index} />
|
|
14
|
+
{:else}
|
|
15
|
+
<TodoSliceComponent {slice} {dev} />
|
|
16
|
+
{/if}
|
|
17
17
|
{/each}
|
|
@@ -6,7 +6,7 @@ if (dev)
|
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{#if dev}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{/if}
|
|
9
|
+
<section data-slice-zone-todo-component="" data-slice-type={type}>
|
|
10
|
+
Could not find a component for Slice type “{type}”
|
|
11
|
+
</section>
|
|
12
|
+
{/if}
|
package/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// export { default as PrismicEmbed } from "./PrismicEmbed.svelte";
|
|
2
2
|
// export { default as PrismicImage } from "./PrismicImage.svelte";
|
|
3
|
-
|
|
3
|
+
export { default as PrismicLink } from "./PrismicLink.svelte";
|
|
4
4
|
// export { default as PrismicText } from "./PrismicText.svelte";
|
|
5
5
|
// export { default as PrismicRichText } from "./PrismicRichText.svelte";
|
|
6
6
|
// export { default as PrismicPreview } from "./PrismicPreview.svelte";
|
package/index.js
CHANGED
|
@@ -16,9 +16,9 @@ declare const __propDef: {
|
|
|
16
16
|
default: {};
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
19
|
+
export type PrismicProviderProps = typeof __propDef.props;
|
|
20
|
+
export type PrismicProviderEvents = typeof __propDef.events;
|
|
21
|
+
export type PrismicProviderSlots = typeof __propDef.slots;
|
|
22
22
|
export default class PrismicProvider extends SvelteComponentTyped<PrismicProviderProps, PrismicProviderEvents, PrismicProviderSlots> {
|
|
23
23
|
}
|
|
24
24
|
export {};
|
|
@@ -9,9 +9,9 @@ declare const __propDef: {
|
|
|
9
9
|
};
|
|
10
10
|
slots: {};
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
12
|
+
export type PrismicEmbedProps = typeof __propDef.props;
|
|
13
|
+
export type PrismicEmbedEvents = typeof __propDef.events;
|
|
14
|
+
export type PrismicEmbedSlots = typeof __propDef.slots;
|
|
15
15
|
export default class PrismicEmbed extends SvelteComponentTyped<PrismicEmbedProps, PrismicEmbedEvents, PrismicEmbedSlots> {
|
|
16
16
|
}
|
|
17
17
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import * as prismicT from "@prismicio/types";
|
|
2
|
+
import type * as prismicT from "@prismicio/types";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
field: prismicT.ImageField;
|
|
@@ -10,9 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
};
|
|
11
11
|
slots: {};
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
13
|
+
export type PrismicImageProps = typeof __propDef.props;
|
|
14
|
+
export type PrismicImageEvents = typeof __propDef.events;
|
|
15
|
+
export type PrismicImageSlots = typeof __propDef.slots;
|
|
16
16
|
export default class PrismicImage extends SvelteComponentTyped<PrismicImageProps, PrismicImageEvents, PrismicImageSlots> {
|
|
17
17
|
}
|
|
18
18
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: any;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {
|
|
8
|
+
default: {};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type PrismicLinkProps = typeof __propDef.props;
|
|
12
|
+
export type PrismicLinkEvents = typeof __propDef.events;
|
|
13
|
+
export type PrismicLinkSlots = typeof __propDef.slots;
|
|
14
|
+
/**
|
|
15
|
+
* Component to render a Prismic Link, Link to Media, Content Relationship, or whole Document as an `a` tag.
|
|
16
|
+
*
|
|
17
|
+
* @example Rendering a Link field:
|
|
18
|
+
* ```svelte
|
|
19
|
+
* <PrismicLink field={document.data.example_link}>
|
|
20
|
+
* Example anchor text.
|
|
21
|
+
* </PrismicLink>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export default class PrismicLink extends SvelteComponentTyped<PrismicLinkProps, PrismicLinkEvents, PrismicLinkSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -12,9 +12,9 @@ declare const __propDef: {
|
|
|
12
12
|
default: {};
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type PrismicPreviewProps = typeof __propDef.props;
|
|
16
|
+
export type PrismicPreviewEvents = typeof __propDef.events;
|
|
17
|
+
export type PrismicPreviewSlots = typeof __propDef.slots;
|
|
18
18
|
export default class PrismicPreview extends SvelteComponentTyped<PrismicPreviewProps, PrismicPreviewEvents, PrismicPreviewSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -12,9 +12,9 @@ declare const __propDef: {
|
|
|
12
12
|
};
|
|
13
13
|
slots: {};
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type PrismicRichTextProps = typeof __propDef.props;
|
|
16
|
+
export type PrismicRichTextEvents = typeof __propDef.events;
|
|
17
|
+
export type PrismicRichTextSlots = typeof __propDef.slots;
|
|
18
18
|
export default class PrismicRichText extends SvelteComponentTyped<PrismicRichTextProps, PrismicRichTextEvents, PrismicRichTextSlots> {
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
@@ -11,9 +11,9 @@ declare const __propDef: {
|
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
14
|
+
export type PrismicTextProps = typeof __propDef.props;
|
|
15
|
+
export type PrismicTextEvents = typeof __propDef.events;
|
|
16
|
+
export type PrismicTextSlots = typeof __propDef.slots;
|
|
17
17
|
export default class PrismicText extends SvelteComponentTyped<PrismicTextProps, PrismicTextEvents, PrismicTextSlots> {
|
|
18
18
|
}
|
|
19
19
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { SvelteComponent } from
|
|
2
|
+
import type { SvelteComponent } from "svelte";
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
slices?: ({
|
|
@@ -17,9 +17,9 @@ declare const __propDef: {
|
|
|
17
17
|
};
|
|
18
18
|
slots: {};
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
20
|
+
export type SliceZoneProps = typeof __propDef.props;
|
|
21
|
+
export type SliceZoneEvents = typeof __propDef.events;
|
|
22
|
+
export type SliceZoneSlots = typeof __propDef.slots;
|
|
23
23
|
export default class SliceZone extends SvelteComponentTyped<SliceZoneProps, SliceZoneEvents, SliceZoneSlots> {
|
|
24
24
|
}
|
|
25
25
|
export {};
|
|
@@ -13,9 +13,9 @@ declare const __propDef: {
|
|
|
13
13
|
};
|
|
14
14
|
slots: {};
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
16
|
+
export type TodoSliceComponentProps = typeof __propDef.props;
|
|
17
|
+
export type TodoSliceComponentEvents = typeof __propDef.events;
|
|
18
|
+
export type TodoSliceComponentSlots = typeof __propDef.slots;
|
|
19
19
|
export default class TodoSliceComponent extends SvelteComponentTyped<TodoSliceComponentProps, TodoSliceComponentEvents, TodoSliceComponentSlots> {
|
|
20
20
|
}
|
|
21
21
|
export {};
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PrismicLink, SliceZone, } from "./components";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Svelte plugin, components, and composables to fetch and present Prismic content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"./components": "./components/index.js",
|
|
29
29
|
"./configurePrismic": "./configurePrismic.js",
|
|
30
30
|
"./injectionSymbols": "./injectionSymbols.js",
|
|
31
|
-
"./types": "./types.js",
|
|
32
31
|
"./usePrismic": "./usePrismic.js"
|
|
33
32
|
},
|
|
34
33
|
"main": "index.js",
|
|
@@ -36,38 +35,44 @@
|
|
|
36
35
|
"types": "index.d.ts",
|
|
37
36
|
"svelte": "./index.js",
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@prismicio/client": "^6.
|
|
40
|
-
"@prismicio/helpers": "^2.3.
|
|
38
|
+
"@prismicio/client": "^6.7.3",
|
|
39
|
+
"@prismicio/helpers": "^2.3.9",
|
|
40
|
+
"@sveltejs/kit": "^1.8.3",
|
|
41
|
+
"svelte": "^3.55.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@prismicio/mock": "0.0
|
|
44
|
-
"@prismicio/types": "^0.
|
|
45
|
-
"@rollup/plugin-inject": "^
|
|
46
|
-
"@sveltejs/
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
48
|
-
"@typescript-eslint/parser": "^5.
|
|
49
|
-
"c8": "^
|
|
44
|
+
"@prismicio/mock": "^0.2.0",
|
|
45
|
+
"@prismicio/types": "^0.2.7",
|
|
46
|
+
"@rollup/plugin-inject": "^5.0.3",
|
|
47
|
+
"@sveltejs/package": "^1.0.2",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
49
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
50
|
+
"@vitest/coverage-c8": "^0.28.5",
|
|
51
|
+
"c8": "^7.13.0",
|
|
50
52
|
"eslint": "^8.15.0",
|
|
51
53
|
"eslint-config-prettier": "^8.5.0",
|
|
52
|
-
"eslint-plugin-prettier": "^4.
|
|
54
|
+
"eslint-plugin-prettier": "^4.2.0",
|
|
53
55
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
54
56
|
"eslint-plugin-tsdoc": "^0.2.16",
|
|
55
|
-
"prettier": "^2.
|
|
57
|
+
"prettier": "^2.8.4",
|
|
56
58
|
"prettier-plugin-jsdoc": "^0.3.38",
|
|
59
|
+
"prettier-plugin-svelte": "^2.9.0",
|
|
57
60
|
"shx": "^0.3.4",
|
|
58
61
|
"standard-version": "^9.3.2",
|
|
59
|
-
"svelte": "^3.
|
|
60
|
-
"svelte-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"vitest": "^0.12.4"
|
|
62
|
+
"svelte-check": "^3.0.3",
|
|
63
|
+
"svelte-preprocess": "^5.0.1",
|
|
64
|
+
"svelte2tsx": "^0.6.1",
|
|
65
|
+
"tslib": "^2.5.0",
|
|
66
|
+
"typescript": "^4.9.5",
|
|
67
|
+
"vitest": "^0.28.5"
|
|
66
68
|
},
|
|
67
69
|
"engines": {
|
|
68
70
|
"node": ">=12.7.0"
|
|
69
71
|
},
|
|
70
72
|
"publishConfig": {
|
|
71
73
|
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"optionalDependencies": {
|
|
76
|
+
"@esbuild/android-arm": "^0.17.10"
|
|
72
77
|
}
|
|
73
78
|
}
|
package/src/app.html
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<link rel="icon" href="/favicon.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
%
|
|
7
|
+
%sveltekit.head%
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
|
-
<div id="svelte">%
|
|
10
|
+
<div id="svelte">%sveltekit.body%</div>
|
|
11
11
|
</body>
|
|
12
12
|
</html>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { setContext } from "svelte";
|
|
3
3
|
|
|
4
4
|
import { prismicKey } from "./injectionSymbols";
|
|
5
|
-
import { PrismicContext } from "
|
|
5
|
+
import type { PrismicContext } from "../types/PrismicContext.type";
|
|
6
6
|
|
|
7
7
|
// export let client: PrismicContext["client"] = undefined;
|
|
8
8
|
// export let linkResolver: PrismicContext["linkResolver"] = undefined;
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
prismic: undefined,
|
|
14
14
|
htmlSerializer: undefined,
|
|
15
15
|
slices: undefined,
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
|
|
18
18
|
setContext<PrismicContext>(prismicKey, {
|
|
19
19
|
client: prismic.client,
|
|
20
20
|
linkResolver: prismic.linkResolver,
|
|
21
21
|
htmlSerializer: prismic.htmlSerializer,
|
|
22
|
-
slices: prismic.slices
|
|
22
|
+
slices: prismic.slices,
|
|
23
23
|
});
|
|
24
24
|
</script>
|
|
25
25
|
|