@prismicio/svelte 0.0.7 → 0.0.8-dev.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.
- package/dist/components/PrismicEmbed.svelte +26 -0
- package/{lib → dist}/components/PrismicEmbed.svelte.d.ts +11 -1
- package/{components → dist/components}/PrismicImage.svelte +1 -2
- package/dist/components/PrismicRichText/DefaultComponent.svelte +51 -0
- package/dist/components/PrismicRichText/DefaultComponent.svelte.d.ts +21 -0
- package/dist/components/PrismicRichText/PrismicRichText.svelte +49 -0
- package/dist/components/PrismicRichText/PrismicRichText.svelte.d.ts +53 -0
- package/dist/components/PrismicRichText/Serialize.svelte +19 -0
- package/dist/components/PrismicRichText/Serialize.svelte.d.ts +21 -0
- package/dist/components/PrismicText.svelte +22 -0
- package/{lib → dist}/components/PrismicText.svelte.d.ts +14 -2
- package/dist/components/SliceZone.svelte +59 -0
- package/dist/components/SliceZone.svelte.d.ts +60 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/src/lib/components/PrismicEmbed.svelte +29 -0
- package/{src → dist/src}/lib/components/PrismicImage.svelte +1 -2
- package/dist/src/lib/components/PrismicRichText/DefaultComponent.svelte +56 -0
- package/dist/src/lib/components/PrismicRichText/PrismicRichText.svelte +69 -0
- package/dist/src/lib/components/PrismicRichText/Serialize.svelte +30 -0
- package/dist/src/lib/components/PrismicText.svelte +29 -0
- package/{src → dist/src}/lib/components/SliceZone.svelte +47 -1
- package/dist/src/lib/components/index.ts +11 -0
- package/dist/src/lib/index.ts +9 -0
- package/{src → dist/src}/routes/+page.server.ts +1 -1
- package/{src → dist/src}/routes/+page.svelte +19 -5
- package/dist/src/routes/components/Emphasis.svelte +3 -0
- package/dist/src/routes/components/index.js +1 -0
- package/dist/src/routes/slices/RichText/index.svelte +9 -0
- package/{src → dist/src}/types/ExampleDocument.type.ts +1 -0
- package/{src → dist/src}/types/index.ts +0 -2
- package/package.json +146 -77
- package/CHANGELOG.md +0 -84
- package/PrismicProvider.svelte +0 -21
- package/components/PrismicEmbed.svelte +0 -10
- package/components/PrismicPreview.svelte +0 -26
- package/components/PrismicRichText.svelte +0 -8
- package/components/PrismicText.svelte +0 -7
- package/components/SliceZone.svelte +0 -17
- package/components/index.js +0 -7
- package/configurePrismic.js +0 -17
- package/index.js +0 -12
- package/injectionSymbols.js +0 -1
- package/lib/PrismicProvider.svelte.d.ts +0 -24
- package/lib/components/PrismicPreview.svelte.d.ts +0 -20
- package/lib/components/PrismicRichText.svelte.d.ts +0 -20
- package/lib/components/SliceZone.svelte.d.ts +0 -25
- package/lib/components/index.d.ts +0 -3
- package/lib/configurePrismic.d.ts +0 -9
- package/lib/index.d.ts +0 -1
- package/lib/injectionSymbols.d.ts +0 -1
- package/lib/usePrismic.d.ts +0 -2
- package/src/lib/PrismicProvider.svelte +0 -26
- package/src/lib/components/PrismicEmbed.svelte +0 -14
- package/src/lib/components/PrismicPreview.svelte +0 -29
- package/src/lib/components/PrismicRichText.svelte +0 -14
- package/src/lib/components/PrismicText.svelte +0 -12
- package/src/lib/components/index.ts +0 -13
- package/src/lib/configurePrismic.ts +0 -30
- package/src/lib/index.ts +0 -18
- package/src/lib/injectionSymbols.ts +0 -1
- package/src/lib/usePrismic.ts +0 -12
- package/src/routes/slices/RichText/index.svelte +0 -8
- package/src/types/PrismicConfig.type.ts +0 -8
- package/src/types/PrismicContext.type.ts +0 -13
- package/types/PrismicContext.type.d.ts +0 -7
- package/usePrismic.js +0 -10
- /package/{lib → dist}/__PRODUCTION__.d.ts +0 -0
- /package/{__PRODUCTION__.js → dist/__PRODUCTION__.js} +0 -0
- /package/{lib → dist}/components/PrismicImage.svelte.d.ts +0 -0
- /package/{components → dist/components}/PrismicLink.svelte +0 -0
- /package/{lib → dist}/components/PrismicLink.svelte.d.ts +0 -0
- /package/{components → dist/components}/TodoSliceComponent.svelte +0 -0
- /package/{lib → dist}/components/TodoSliceComponent.svelte.d.ts +0 -0
- /package/{src → dist/src}/app.html +0 -0
- /package/{src → dist/src}/global.d.ts +0 -0
- /package/{src → dist/src}/lib/__PRODUCTION__.ts +0 -0
- /package/{src → dist/src}/lib/components/PrismicLink.svelte +0 -0
- /package/{src → dist/src}/lib/components/TodoSliceComponent.svelte +0 -0
- /package/{src → dist/src}/routes/slices/CodeSnippet/index.svelte +0 -0
- /package/{src → dist/src}/routes/slices/index.ts +0 -0
- /package/{src → dist/src}/types/CodeSnippetSlice.type.ts +0 -0
- /package/{src → dist/src}/types/PageDocument.type.ts +0 -0
- /package/{src → dist/src}/types/RichTextSlice.type.ts +0 -0
- /package/{src → dist/src}/types/Route.type.ts +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { SvelteComponent } from "svelte";
|
|
3
|
+
import type {
|
|
4
|
+
RichTextFunctionSerializer,
|
|
5
|
+
TreeNode,
|
|
6
|
+
} from "@prismicio/richtext";
|
|
7
|
+
import type { LinkResolverFunction } from "@prismicio/helpers";
|
|
8
|
+
|
|
9
|
+
import Default from "./DefaultComponent.svelte";
|
|
10
|
+
|
|
11
|
+
export let serializer:
|
|
12
|
+
| RichTextFunctionSerializer<typeof SvelteComponent, TreeNode>
|
|
13
|
+
| undefined;
|
|
14
|
+
export let nodes: TreeNode[] = [];
|
|
15
|
+
export let linkResolver: LinkResolverFunction | undefined = undefined;
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#each nodes as node}
|
|
19
|
+
<svelte:component
|
|
20
|
+
this={(serializer &&
|
|
21
|
+
serializer(node.type, node.node, node.text, node.children, node.key)) ||
|
|
22
|
+
Default}
|
|
23
|
+
{...node}
|
|
24
|
+
{linkResolver}
|
|
25
|
+
>
|
|
26
|
+
{#if node.children.length > 0}
|
|
27
|
+
<svelte:self nodes={node.children} {serializer} />
|
|
28
|
+
{/if}
|
|
29
|
+
</svelte:component>
|
|
30
|
+
{/each}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as prismicH from "@prismicio/helpers";
|
|
3
|
+
import type * as prismicR from "@prismicio/richtext";
|
|
4
|
+
|
|
5
|
+
import type { RichTextField as RichTextFieldType } from "@prismicio/types";
|
|
6
|
+
import type { TitleField as TitleFieldType } from "@prismicio/types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A Rich Text or Title field from Prismic.
|
|
10
|
+
*/
|
|
11
|
+
export let field: TitleFieldType | RichTextFieldType;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The separator used between blocks. Defaults to `\n`.
|
|
15
|
+
*/
|
|
16
|
+
export let separator: string | undefined = undefined;
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<!--
|
|
20
|
+
@component
|
|
21
|
+
Component to render a Prismic Rich Text or Title field as plain text.
|
|
22
|
+
|
|
23
|
+
@example Rendering a Rich Text field:
|
|
24
|
+
```svelte
|
|
25
|
+
<PrismicText field={document.data.example_rich_text} />
|
|
26
|
+
```
|
|
27
|
+
-->
|
|
28
|
+
|
|
29
|
+
{@html prismicH.asText(field, separator)}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
type SliceComponents = Record<
|
|
8
8
|
string,
|
|
9
|
-
|
|
9
|
+
new (...args: any[]) => SvelteComponent
|
|
10
10
|
>;
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -45,16 +45,62 @@
|
|
|
45
45
|
| SliceLikeRestV2<SliceType>
|
|
46
46
|
| SliceLikeGraphQL<SliceType>;
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* An array of Prismic Slices, such as the `slices` property from a Prismic document.
|
|
50
|
+
*/
|
|
48
51
|
export let slices: SliceLike[] = [];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* An object that maps Slice components to their corresponding API IDs
|
|
55
|
+
*
|
|
56
|
+
* @example An example map:
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* import BlockQuote from "./BlockQuote.svelte";
|
|
60
|
+
* import HeroImage from "./HeroImage.svelte";
|
|
61
|
+
*
|
|
62
|
+
* const components = {
|
|
63
|
+
* block_quote: BlockQuote,
|
|
64
|
+
* hero_image: HeroImage,
|
|
65
|
+
* };
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
49
68
|
export let components: SliceComponents = {};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Arbitrary data passed to all Slice components as a `context` prop.
|
|
72
|
+
*/
|
|
50
73
|
export let context: any = {};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The Svelte component rendered if a component mapping from the `components`
|
|
77
|
+
* prop cannot be found.
|
|
78
|
+
*/
|
|
51
79
|
export let defaultComponent:
|
|
52
80
|
| SvelteComponent
|
|
53
81
|
| (new (...args: any[]) => SvelteComponent)
|
|
54
82
|
| undefined = undefined;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether the app is in development mode. When true, the SliceZone may
|
|
86
|
+
* display error messages in the UI.
|
|
87
|
+
*/
|
|
55
88
|
export let dev: boolean = false;
|
|
56
89
|
</script>
|
|
57
90
|
|
|
91
|
+
<!--
|
|
92
|
+
@component
|
|
93
|
+
Component to render an array of Prismic Slices.
|
|
94
|
+
|
|
95
|
+
@example Rendering a Rich Text field:
|
|
96
|
+
```svelte
|
|
97
|
+
<SliceZone slices={document.data.slices} components={{
|
|
98
|
+
block_quote: BlockQuote,
|
|
99
|
+
hero_image: HeroImage
|
|
100
|
+
}} />
|
|
101
|
+
```
|
|
102
|
+
-->
|
|
103
|
+
|
|
58
104
|
{#each slices as slice, index}
|
|
59
105
|
{@const type = "slice_type" in slice ? slice.slice_type : slice.type}
|
|
60
106
|
{@const Component = components[type] || defaultComponent}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default as PrismicEmbed } from "./PrismicEmbed.svelte";
|
|
2
|
+
|
|
3
|
+
export { default as PrismicImage } from "./PrismicImage.svelte";
|
|
4
|
+
|
|
5
|
+
export { default as PrismicLink } from "./PrismicLink.svelte";
|
|
6
|
+
|
|
7
|
+
export { default as PrismicText } from "./PrismicText.svelte";
|
|
8
|
+
|
|
9
|
+
export { default as PrismicRichText } from "./PrismicRichText/PrismicRichText.svelte";
|
|
10
|
+
|
|
11
|
+
export { default as SliceZone } from "./SliceZone.svelte";
|
|
@@ -9,7 +9,7 @@ export const load = (async ({ fetch }) => {
|
|
|
9
9
|
const pageDocument: PageDocument = await client.getSingle("homepage");
|
|
10
10
|
|
|
11
11
|
const exampleClient = prismic.createClient("example-prismic-repo", { fetch })
|
|
12
|
-
const exampleDocument = exampleClient.getFirst()
|
|
12
|
+
const exampleDocument = exampleClient.getFirst({ page: 11, pageSize: 1})
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
return {
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
SliceZone,
|
|
4
|
+
PrismicLink,
|
|
5
|
+
PrismicImage,
|
|
6
|
+
PrismicRichText,
|
|
7
|
+
PrismicText,
|
|
8
|
+
PrismicEmbed,
|
|
9
|
+
} from "$lib";
|
|
3
10
|
import { RichText, CodeSnippet } from "./slices";
|
|
11
|
+
|
|
4
12
|
import type { PageData } from "./$types";
|
|
13
|
+
import { page } from "$app/stores";
|
|
5
14
|
|
|
6
15
|
const components = {
|
|
7
16
|
rich_text: RichText,
|
|
@@ -13,11 +22,14 @@
|
|
|
13
22
|
|
|
14
23
|
<main>
|
|
15
24
|
<h1>Welcome to SvelteKit</h1>
|
|
25
|
+
<h2><code>PrismicText</code></h2>
|
|
26
|
+
<PrismicText field={data.exampleDocument.data.example_rich_text} />
|
|
27
|
+
<h2><code>PrismicRichText</code></h2>
|
|
28
|
+
<PrismicRichText field={data.exampleDocument.data.example_rich_text} />
|
|
16
29
|
<h2><code>PrismicImage</code></h2>
|
|
17
30
|
<PrismicImage
|
|
18
31
|
field={data.exampleDocument.data.example_image}
|
|
19
|
-
|
|
20
|
-
height="200"
|
|
32
|
+
height="200px"
|
|
21
33
|
alt=""
|
|
22
34
|
/>
|
|
23
35
|
<h2><code>PrismicLink</code></h2>
|
|
@@ -30,18 +42,20 @@
|
|
|
30
42
|
class="doggo"
|
|
31
43
|
field={data.exampleDocument.data.example_link}>Link</PrismicLink
|
|
32
44
|
>
|
|
45
|
+
<h2><code>PrismicEmbed</code></h2>
|
|
46
|
+
<PrismicEmbed field={data.exampleDocument.data.example_embed} />
|
|
33
47
|
<h2><code>SliceZone</code></h2>
|
|
34
48
|
<SliceZone slices={data.pageDocument.data.body} {components} />
|
|
35
49
|
</main>
|
|
36
50
|
|
|
37
51
|
<style>
|
|
38
52
|
main {
|
|
39
|
-
max-width: min(90%,
|
|
53
|
+
max-width: min(90%, 700px);
|
|
40
54
|
margin: auto;
|
|
41
55
|
}
|
|
42
56
|
|
|
43
57
|
:global(img) {
|
|
44
|
-
/* width: 100%; */
|
|
45
58
|
height: auto;
|
|
59
|
+
max-width: 100%;
|
|
46
60
|
}
|
|
47
61
|
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Em } from "./Emphasis.svelte";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { RichTextSlice } from "./../../../types/RichTextSlice.type";
|
|
3
|
+
import PrismicRichText from "$lib/components/PrismicRichText/PrismicRichText.svelte";
|
|
4
|
+
import Emphasis from "./../../components/Emphasis.svelte";
|
|
5
|
+
|
|
6
|
+
export let slice: RichTextSlice;
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<PrismicRichText field={slice.primary.content} components={{ em: Emphasis }} />
|
|
@@ -3,5 +3,6 @@ import type * as prismicT from "@prismicio/types";
|
|
|
3
3
|
export type ExampleDocument = prismicT.PrismicDocument<{
|
|
4
4
|
example_link: prismicT.LinkField;
|
|
5
5
|
example_content_relationship: prismicT.ContentRelationshipField;
|
|
6
|
+
example_rich_text: prismicT.RichTextField;
|
|
6
7
|
example_image: prismicT.ImageField;
|
|
7
8
|
}>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export type { CodeSnippetSlice } from "./CodeSnippetSlice.type";
|
|
2
2
|
export type { PageDocument } from "./PageDocument.type";
|
|
3
3
|
export type { ExampleDocument } from "./ExampleDocument.type";
|
|
4
|
-
export type { PrismicConfig } from "./PrismicConfig.type";
|
|
5
|
-
export type { PrismicContext } from "./PrismicContext.type";
|
|
6
4
|
export type { RichTextSlice } from "./RichTextSlice.type";
|
|
7
5
|
export type { Route } from "./Route.type";
|
package/package.json
CHANGED
|
@@ -1,78 +1,147 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
2
|
+
"name": "@prismicio/svelte",
|
|
3
|
+
"version": "0.0.8-dev.1",
|
|
4
|
+
"description": "Svelte plugin, components, and composables to fetch and present Prismic content",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"prismic",
|
|
8
|
+
"svelte"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "ssh://git@github.com/prismicio/prismic-svelte.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"author": "Prismic <contact@prismic.io> (https://prismic.io)",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": "./package.json",
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"svelte": "./dist/index.js",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./index.d.ts": "./dist/index.d.ts"
|
|
25
|
+
},
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"svelte": "./dist/index.js",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "svelte-package -o dist package && shx cp -r src dist/src",
|
|
32
|
+
"dev": "vite dev",
|
|
33
|
+
"format": "prettier --write .",
|
|
34
|
+
"prepare": "npm run build",
|
|
35
|
+
"release": "npm run build && npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
|
|
36
|
+
"release:dry": "standard-version --dry-run",
|
|
37
|
+
"release:alpha": "npm run build && npm run test && standard-version --release-as major --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
|
|
38
|
+
"release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run",
|
|
39
|
+
"release:dev": "npm run build && npm run test && standard-version --prerelease dev && git push --follow-tags && npm run build && npm publish --tag dev",
|
|
40
|
+
"release:dev:dry": "standard-version --prerelease dev --dry-run",
|
|
41
|
+
"lint": "eslint --ext .js,.ts .",
|
|
42
|
+
"unit": "vitest run --coverage",
|
|
43
|
+
"unit:watch": "vitest watch",
|
|
44
|
+
"test": "npm run lint && npm run unit",
|
|
45
|
+
"preview": "svelte-kit preview",
|
|
46
|
+
"package": "svelte-package -o dist package",
|
|
47
|
+
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
48
|
+
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@prismicio/client": "^6.7.3",
|
|
52
|
+
"@prismicio/helpers": "^2.3.9",
|
|
53
|
+
"@prismicio/richtext": "^2.2.0-alpha.0",
|
|
54
|
+
"@sveltejs/kit": "^1.8.3",
|
|
55
|
+
"svelte": "^3.55.1"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@prismicio/mock": "^0.2.0",
|
|
59
|
+
"@prismicio/types": "^0.2.7",
|
|
60
|
+
"@rollup/plugin-inject": "^5.0.3",
|
|
61
|
+
"@sveltejs/package": "^2.0.0",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
63
|
+
"@typescript-eslint/parser": "^5.53.0",
|
|
64
|
+
"@vitest/coverage-c8": "^0.28.5",
|
|
65
|
+
"c8": "^7.13.0",
|
|
66
|
+
"eslint": "^8.15.0",
|
|
67
|
+
"eslint-config-prettier": "^8.5.0",
|
|
68
|
+
"eslint-plugin-prettier": "^4.2.0",
|
|
69
|
+
"eslint-plugin-svelte3": "^4.0.0",
|
|
70
|
+
"eslint-plugin-tsdoc": "^0.2.16",
|
|
71
|
+
"prettier": "^2.8.4",
|
|
72
|
+
"prettier-plugin-jsdoc": "^0.3.38",
|
|
73
|
+
"prettier-plugin-svelte": "^2.9.0",
|
|
74
|
+
"shx": "^0.3.4",
|
|
75
|
+
"standard-version": "^9.3.2",
|
|
76
|
+
"svelte-check": "^3.0.3",
|
|
77
|
+
"svelte-preprocess": "^5.0.1",
|
|
78
|
+
"svelte2tsx": "^0.6.1",
|
|
79
|
+
"tslib": "^2.5.0",
|
|
80
|
+
"typescript": "^4.9.5",
|
|
81
|
+
"vitest": "^0.28.5"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=12.7.0"
|
|
85
|
+
},
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"access": "public"
|
|
88
|
+
},
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"@esbuild/android-arm": "^0.17.10"
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dist"
|
|
94
|
+
],
|
|
95
|
+
"typesVersions": {
|
|
96
|
+
">4.0": {
|
|
97
|
+
"PrismicProvider.svelte": [
|
|
98
|
+
"./dist/PrismicProvider.svelte.d.ts"
|
|
99
|
+
],
|
|
100
|
+
"components/PrismicEmbed.svelte": [
|
|
101
|
+
"./dist/components/PrismicEmbed.svelte.d.ts"
|
|
102
|
+
],
|
|
103
|
+
"components/PrismicImage.svelte": [
|
|
104
|
+
"./dist/components/PrismicImage.svelte.d.ts"
|
|
105
|
+
],
|
|
106
|
+
"components/PrismicLink.svelte": [
|
|
107
|
+
"./dist/components/PrismicLink.svelte.d.ts"
|
|
108
|
+
],
|
|
109
|
+
"components/PrismicPreview.svelte": [
|
|
110
|
+
"./dist/components/PrismicPreview.svelte.d.ts"
|
|
111
|
+
],
|
|
112
|
+
"components/PrismicRichText/DefaultComponent.svelte": [
|
|
113
|
+
"./dist/components/PrismicRichText/DefaultComponent.svelte.d.ts"
|
|
114
|
+
],
|
|
115
|
+
"components/PrismicRichText/PrismicRichText.svelte": [
|
|
116
|
+
"./dist/components/PrismicRichText/PrismicRichText.svelte.d.ts"
|
|
117
|
+
],
|
|
118
|
+
"components/PrismicRichText/Serialize.svelte": [
|
|
119
|
+
"./dist/components/PrismicRichText/Serialize.svelte.d.ts"
|
|
120
|
+
],
|
|
121
|
+
"components/PrismicText.svelte": [
|
|
122
|
+
"./dist/components/PrismicText.svelte.d.ts"
|
|
123
|
+
],
|
|
124
|
+
"components/SliceZone.svelte": [
|
|
125
|
+
"./dist/components/SliceZone.svelte.d.ts"
|
|
126
|
+
],
|
|
127
|
+
"components/TodoSliceComponent.svelte": [
|
|
128
|
+
"./dist/components/TodoSliceComponent.svelte.d.ts"
|
|
129
|
+
],
|
|
130
|
+
"components": [
|
|
131
|
+
"./dist/components/index.d.ts"
|
|
132
|
+
],
|
|
133
|
+
"configurePrismic": [
|
|
134
|
+
"./dist/configurePrismic.d.ts"
|
|
135
|
+
],
|
|
136
|
+
"index": [
|
|
137
|
+
"./dist/index.d.ts"
|
|
138
|
+
],
|
|
139
|
+
"injectionSymbols": [
|
|
140
|
+
"./dist/injectionSymbols.d.ts"
|
|
141
|
+
],
|
|
142
|
+
"usePrismic": [
|
|
143
|
+
"./dist/usePrismic.d.ts"
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
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
|
-
|
|
5
|
-
### [0.0.7](https://github.com/prismicio/prismic-svelte/compare/v0.0.6...v0.0.7) (2023-03-02)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
* create `<PrismicImage>` component ([#5](https://github.com/prismicio/prismic-svelte/issues/5)) ([9b29b58](https://github.com/prismicio/prismic-svelte/commit/9b29b58d771ae0d6cf6960a28d35035c7fff23b0))
|
|
11
|
-
|
|
12
|
-
### [0.0.6](https://github.com/prismicio/prismic-svelte/compare/v0.0.5...v0.0.6) (2023-02-24)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
* add `<PrismicLink>` component ([1db9dc0](https://github.com/prismicio/prismic-svelte/commit/1db9dc0cd6a24de87505b5e1486fe9458cb7be01))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Chore
|
|
21
|
-
|
|
22
|
-
* fix slice typing ([16340b3](https://github.com/prismicio/prismic-svelte/commit/16340b320396f69127e89d26dae498baff8fa299))
|
|
23
|
-
|
|
24
|
-
### [0.0.5](https://github.com/prismicio/prismic-svelte/compare/v0.0.4...v0.0.5) (2023-02-23)
|
|
25
|
-
|
|
26
|
-
### Chore
|
|
27
|
-
|
|
28
|
-
- upgrade SvelteKit to 1.0 ([#3](https://github.com/prismicio/prismic-svelte/issues/3)) ([8d5addc](https://github.com/prismicio/prismic-svelte/commit/8d5addcdd669895ccacb666286b57af7825f4869))
|
|
29
|
-
|
|
30
|
-
### [0.0.4](https://github.com/prismicio/prismic-svelte/compare/v0.0.3...v0.0.4) (2022-05-27)
|
|
31
|
-
|
|
32
|
-
### Chore
|
|
33
|
-
|
|
34
|
-
- Update docs link ([e8d14cf](https://github.com/prismicio/prismic-svelte/commit/e8d14cf66ee9c52d624848dbcabe29a531ecae5e))
|
|
35
|
-
|
|
36
|
-
### [0.0.3](https://github.com/prismicio/prismic-svelte/compare/v0.0.2...v0.0.3) (2022-05-17)
|
|
37
|
-
|
|
38
|
-
### Bug Fixes
|
|
39
|
-
|
|
40
|
-
- change dev default value to ([11903bc](https://github.com/prismicio/prismic-svelte/commit/11903bc0e11f86e57bdebee3888c8b7efcffac97))
|
|
41
|
-
|
|
42
|
-
### Documentation
|
|
43
|
-
|
|
44
|
-
- add experimental disclaimer ([3779ec1](https://github.com/prismicio/prismic-svelte/commit/3779ec199cbcbf5d04bacbf2274cf484c1eec0db))
|
|
45
|
-
|
|
46
|
-
### Chore
|
|
47
|
-
|
|
48
|
-
- **deps:** maintain lock file ([d7ab62f](https://github.com/prismicio/prismic-svelte/commit/d7ab62f28884c2734ef2ae96b6a2f094ef835211))
|
|
49
|
-
|
|
50
|
-
### [0.0.2](https://github.com/prismicio/prismic-svelte/compare/v0.0.1...v0.0.2) (2022-05-13)
|
|
51
|
-
|
|
52
|
-
### Chore
|
|
53
|
-
|
|
54
|
-
- fix release script ([074d4fb](https://github.com/prismicio/prismic-svelte/commit/074d4fbdd6e3a7fd49b2e7fbe6b8a6b7b315491f))
|
|
55
|
-
- fix release script ([026072a](https://github.com/prismicio/prismic-svelte/commit/026072ac3ff6fe08e161ac15c8776767af70f0d3))
|
|
56
|
-
|
|
57
|
-
### 0.0.1 (2022-05-13)
|
|
58
|
-
|
|
59
|
-
### Features
|
|
60
|
-
|
|
61
|
-
- Change PrismicProvider prop to only Command line to bootstrap prismic projects. ([e4675d4](https://github.com/prismicio/prismic-svelte/commit/e4675d48d4a2d9fe89c04aa4273948ef2a84d018))
|
|
62
|
-
- Finish creating components; Create Slices for route. ([5b18487](https://github.com/prismicio/prismic-svelte/commit/5b1848736dcf5d75e09556a57756017fc46847f4))
|
|
63
|
-
- Get htmlSerializer from context in PrismicRichText ([36664bc](https://github.com/prismicio/prismic-svelte/commit/36664bc72d7e9eb6cd353c96ae22ed209143a905))
|
|
64
|
-
- Handle missing url ([54b3a75](https://github.com/prismicio/prismic-svelte/commit/54b3a7529eda7b29542483a5b7b0ab33c2b22643))
|
|
65
|
-
- Improve mock data ([782a0f0](https://github.com/prismicio/prismic-svelte/commit/782a0f031c41aeefb2d14220146087fc164b6eae))
|
|
66
|
-
- Merge Lucie's and Sam's link components ([3ea6c7f](https://github.com/prismicio/prismic-svelte/commit/3ea6c7fdb48ad718a62f0cf70662fdb79e6e7d96))
|
|
67
|
-
- Rename to ([cc271cb](https://github.com/prismicio/prismic-svelte/commit/cc271cb285089f3bc6104b771711fe62fb3f5fea))
|
|
68
|
-
- revamp slicezone component ([65c55b8](https://github.com/prismicio/prismic-svelte/commit/65c55b84f7c7eea7e65470f6b5a101c7749d2cde))
|
|
69
|
-
- setup link component ([0545d48](https://github.com/prismicio/prismic-svelte/commit/0545d48fcb0413f40e917d1f4857996d5f402e69))
|
|
70
|
-
- setup prismic provider ([9b9752f](https://github.com/prismicio/prismic-svelte/commit/9b9752fce5f4754bc195e83f44a4bb081e203b95))
|
|
71
|
-
- Setup Prismicimage component ([0033cb5](https://github.com/prismicio/prismic-svelte/commit/0033cb515f2444a5f45040d28a27bf05ac7e0dd0))
|
|
72
|
-
|
|
73
|
-
### Bug Fixes
|
|
74
|
-
|
|
75
|
-
- Add shx so commands work cross platform ([1731f64](https://github.com/prismicio/prismic-svelte/commit/1731f64fa9310fdb93cf15b250320e0939d73f8b))
|
|
76
|
-
|
|
77
|
-
### Chore
|
|
78
|
-
|
|
79
|
-
- Add TODOs, rename plaintext component ([691aab7](https://github.com/prismicio/prismic-svelte/commit/691aab7bc9d47d2bdb47024e30ca90301813c85d))
|
|
80
|
-
- init project ([9afa15a](https://github.com/prismicio/prismic-svelte/commit/9afa15a8a4372de8eb5b16e087433d2a640a93a0))
|
|
81
|
-
- maintain repository ([e3ae492](https://github.com/prismicio/prismic-svelte/commit/e3ae492c0c03e121c8bddf03c96065485a448863))
|
|
82
|
-
- migrate to vitest ([bbae453](https://github.com/prismicio/prismic-svelte/commit/bbae45309262b845dde7149ffad938bcc8aabc66))
|
|
83
|
-
- setup todo components ([d57cf26](https://github.com/prismicio/prismic-svelte/commit/d57cf263f5294d9227a43bb9bb82e9e788dca09e))
|
|
84
|
-
- update template config ([93a1b59](https://github.com/prismicio/prismic-svelte/commit/93a1b5971cf796f6eb9433044defc67eccf56bd2))
|
package/PrismicProvider.svelte
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script>import { setContext } from "svelte";
|
|
2
|
-
import { prismicKey } from "./injectionSymbols";
|
|
3
|
-
// export let client: PrismicContext["client"] = undefined;
|
|
4
|
-
// export let linkResolver: PrismicContext["linkResolver"] = undefined;
|
|
5
|
-
// export let htmlSerializer: PrismicContext["htmlSerializer"] = undefined;
|
|
6
|
-
export let prismic = {
|
|
7
|
-
client: undefined,
|
|
8
|
-
linkResolver: undefined,
|
|
9
|
-
prismic: undefined,
|
|
10
|
-
htmlSerializer: undefined,
|
|
11
|
-
slices: undefined,
|
|
12
|
-
};
|
|
13
|
-
setContext(prismicKey, {
|
|
14
|
-
client: prismic.client,
|
|
15
|
-
linkResolver: prismic.linkResolver,
|
|
16
|
-
htmlSerializer: prismic.htmlSerializer,
|
|
17
|
-
slices: prismic.slices,
|
|
18
|
-
});
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<slot />
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script>import * as prismic from "@prismicio/client";
|
|
2
|
-
import { goto } from "$app/navigation";
|
|
3
|
-
import { onMount } from "svelte";
|
|
4
|
-
export let linkResolver;
|
|
5
|
-
export let defaultURL;
|
|
6
|
-
export let client;
|
|
7
|
-
onMount(async () => {
|
|
8
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
9
|
-
const previewToken = urlParams.get("token");
|
|
10
|
-
const documentID = urlParams.get("documentId");
|
|
11
|
-
if (documentID && previewToken) {
|
|
12
|
-
const redirect = await client.resolvePreviewURL({
|
|
13
|
-
documentID,
|
|
14
|
-
defaultURL,
|
|
15
|
-
previewToken,
|
|
16
|
-
linkResolver,
|
|
17
|
-
});
|
|
18
|
-
await goto(redirect);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
console.log("Could not resolve preview URL.");
|
|
22
|
-
// TODO: Handle else
|
|
23
|
-
});
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<slot />
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
-
import { usePrismic } from "./..";
|
|
3
|
-
let { htmlSerializer, linkResolver } = usePrismic();
|
|
4
|
-
export let field;
|
|
5
|
-
export { htmlSerializer, linkResolver };
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
{@html prismicH.asHTML(field, linkResolver, htmlSerializer)}
|