@prismicio/svelte 0.0.2 → 0.0.3
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 +17 -0
- package/PrismicProvider.svelte +19 -19
- package/PrismicProvider.svelte.d.ts +24 -24
- package/README.md +2 -0
- package/components/PrismicEmbed.svelte +1 -1
- package/components/PrismicEmbed.svelte.d.ts +17 -17
- package/components/PrismicImage.svelte +17 -17
- package/components/PrismicImage.svelte.d.ts +18 -18
- package/components/PrismicLink.svelte +34 -34
- package/components/PrismicLink.svelte.d.ts +29 -29
- package/components/PrismicPreview.svelte +18 -18
- package/components/PrismicPreview.svelte.d.ts +20 -20
- package/components/PrismicRichText.svelte +5 -5
- package/components/PrismicRichText.svelte.d.ts +20 -20
- package/components/PrismicText.svelte +3 -3
- package/components/PrismicText.svelte.d.ts +19 -19
- package/components/SliceZone.svelte +6 -6
- package/components/SliceZone.svelte.d.ts +25 -25
- package/components/TodoSliceComponent.svelte +5 -5
- package/components/TodoSliceComponent.svelte.d.ts +21 -21
- package/components/index.d.ts +1 -1
- package/components/index.js +7 -7
- package/configurePrismic.d.ts +9 -9
- package/configurePrismic.js +17 -17
- package/index.d.ts +1 -1
- package/index.js +13 -13
- package/injectionSymbols.d.ts +1 -1
- package/injectionSymbols.js +1 -1
- package/package.json +3 -4
- package/src/lib/components/SliceZone.svelte +1 -1
- package/src/lib/components/TodoSliceComponent.svelte +1 -1
- package/types.d.ts +27 -27
- package/types.js +1 -1
- package/usePrismic.d.ts +2 -2
- package/usePrismic.js +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.3](https://github.com/prismicio/prismic-svelte/compare/v0.0.2...v0.0.3) (2022-05-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* change dev default value to ([11903bc](https://github.com/prismicio/prismic-svelte/commit/11903bc0e11f86e57bdebee3888c8b7efcffac97))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
|
|
15
|
+
* add experimental disclaimer ([3779ec1](https://github.com/prismicio/prismic-svelte/commit/3779ec199cbcbf5d04bacbf2274cf484c1eec0db))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Chore
|
|
19
|
+
|
|
20
|
+
* **deps:** maintain lock file ([d7ab62f](https://github.com/prismicio/prismic-svelte/commit/d7ab62f28884c2734ef2ae96b6a2f094ef835211))
|
|
21
|
+
|
|
5
22
|
### [0.0.2](https://github.com/prismicio/prismic-svelte/compare/v0.0.1...v0.0.2) (2022-05-13)
|
|
6
23
|
|
|
7
24
|
|
package/PrismicProvider.svelte
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<script>import { setContext } from "svelte";
|
|
2
|
-
import { prismicKey } from "./injectionSymbols";
|
|
3
|
-
import "./types";
|
|
4
|
-
// export let client: PrismicContext["client"] = undefined;
|
|
5
|
-
// export let linkResolver: PrismicContext["linkResolver"] = undefined;
|
|
6
|
-
// export let htmlSerializer: PrismicContext["htmlSerializer"] = undefined;
|
|
7
|
-
export let prismic = {
|
|
8
|
-
client: undefined,
|
|
9
|
-
linkResolver: undefined,
|
|
10
|
-
prismic: undefined,
|
|
11
|
-
htmlSerializer: undefined,
|
|
12
|
-
slices: undefined,
|
|
13
|
-
};
|
|
14
|
-
setContext(prismicKey, {
|
|
15
|
-
client: prismic.client,
|
|
16
|
-
linkResolver: prismic.linkResolver,
|
|
17
|
-
htmlSerializer: prismic.htmlSerializer,
|
|
18
|
-
slices: prismic.slices
|
|
19
|
-
});
|
|
1
|
+
<script>import { setContext } from "svelte";
|
|
2
|
+
import { prismicKey } from "./injectionSymbols";
|
|
3
|
+
import "./types";
|
|
4
|
+
// export let client: PrismicContext["client"] = undefined;
|
|
5
|
+
// export let linkResolver: PrismicContext["linkResolver"] = undefined;
|
|
6
|
+
// export let htmlSerializer: PrismicContext["htmlSerializer"] = undefined;
|
|
7
|
+
export let prismic = {
|
|
8
|
+
client: undefined,
|
|
9
|
+
linkResolver: undefined,
|
|
10
|
+
prismic: undefined,
|
|
11
|
+
htmlSerializer: undefined,
|
|
12
|
+
slices: undefined,
|
|
13
|
+
};
|
|
14
|
+
setContext(prismicKey, {
|
|
15
|
+
client: prismic.client,
|
|
16
|
+
linkResolver: prismic.linkResolver,
|
|
17
|
+
htmlSerializer: prismic.htmlSerializer,
|
|
18
|
+
slices: prismic.slices
|
|
19
|
+
});
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<slot />
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
prismic?: {
|
|
5
|
-
client: undefined;
|
|
6
|
-
linkResolver: undefined;
|
|
7
|
-
prismic: undefined;
|
|
8
|
-
htmlSerializer: undefined;
|
|
9
|
-
slices: undefined;
|
|
10
|
-
} | undefined;
|
|
11
|
-
};
|
|
12
|
-
events: {
|
|
13
|
-
[evt: string]: CustomEvent<any>;
|
|
14
|
-
};
|
|
15
|
-
slots: {
|
|
16
|
-
default: {};
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export declare type PrismicProviderProps = typeof __propDef.props;
|
|
20
|
-
export declare type PrismicProviderEvents = typeof __propDef.events;
|
|
21
|
-
export declare type PrismicProviderSlots = typeof __propDef.slots;
|
|
22
|
-
export default class PrismicProvider extends SvelteComponentTyped<PrismicProviderProps, PrismicProviderEvents, PrismicProviderSlots> {
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
prismic?: {
|
|
5
|
+
client: undefined;
|
|
6
|
+
linkResolver: undefined;
|
|
7
|
+
prismic: undefined;
|
|
8
|
+
htmlSerializer: undefined;
|
|
9
|
+
slices: undefined;
|
|
10
|
+
} | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare type PrismicProviderProps = typeof __propDef.props;
|
|
20
|
+
export declare type PrismicProviderEvents = typeof __propDef.events;
|
|
21
|
+
export declare type PrismicProviderSlots = typeof __propDef.slots;
|
|
22
|
+
export default class PrismicProvider extends SvelteComponentTyped<PrismicProviderProps, PrismicProviderEvents, PrismicProviderSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ Replace all on all files (README.md, CONTRIBUTING.md, bug_report.md, package.jso
|
|
|
19
19
|
|
|
20
20
|
<!-- TODO: Replacing link to Prismic with [Prismic][prismic] is useful here -->
|
|
21
21
|
|
|
22
|
+
> ⚠ This project is in an experimental state. Use it at your own risk or stay tuned for the official release!
|
|
23
|
+
|
|
22
24
|
[Svelte][svelte] components and helpers to fetch and present [Prismic][prismic] content.
|
|
23
25
|
|
|
24
26
|
- 📝 Display content from Prismic like [Rich Text][prismic-rich-text] and [Link][prismic-link] fields;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type * as prismicT from "@prismicio/types";
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
field: prismicT.EmbedField;
|
|
6
|
-
};
|
|
7
|
-
events: {
|
|
8
|
-
[evt: string]: CustomEvent<any>;
|
|
9
|
-
};
|
|
10
|
-
slots: {};
|
|
11
|
-
};
|
|
12
|
-
export declare type PrismicEmbedProps = typeof __propDef.props;
|
|
13
|
-
export declare type PrismicEmbedEvents = typeof __propDef.events;
|
|
14
|
-
export declare type PrismicEmbedSlots = typeof __propDef.slots;
|
|
15
|
-
export default class PrismicEmbed extends SvelteComponentTyped<PrismicEmbedProps, PrismicEmbedEvents, PrismicEmbedSlots> {
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type * as prismicT from "@prismicio/types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
field: prismicT.EmbedField;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type PrismicEmbedProps = typeof __propDef.props;
|
|
13
|
+
export declare type PrismicEmbedEvents = typeof __propDef.events;
|
|
14
|
+
export declare type PrismicEmbedSlots = typeof __propDef.slots;
|
|
15
|
+
export default class PrismicEmbed extends SvelteComponentTyped<PrismicEmbedProps, PrismicEmbedEvents, PrismicEmbedSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<script>import "@prismicio/types";
|
|
2
|
-
export let field;
|
|
3
|
-
let className;
|
|
4
|
-
// creates a `class` property, even
|
|
5
|
-
// though it is a reserved word
|
|
6
|
-
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);
|
|
1
|
+
<script>import "@prismicio/types";
|
|
2
|
+
export let field;
|
|
3
|
+
let className;
|
|
4
|
+
// creates a `class` property, even
|
|
5
|
+
// though it is a reserved word
|
|
6
|
+
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
18
|
</script>
|
|
19
19
|
|
|
20
20
|
{#if field.url}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import * as prismicT from "@prismicio/types";
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
field: prismicT.ImageField;
|
|
6
|
-
class: string;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {};
|
|
12
|
-
};
|
|
13
|
-
export declare type PrismicImageProps = typeof __propDef.props;
|
|
14
|
-
export declare type PrismicImageEvents = typeof __propDef.events;
|
|
15
|
-
export declare type PrismicImageSlots = typeof __propDef.slots;
|
|
16
|
-
export default class PrismicImage extends SvelteComponentTyped<PrismicImageProps, PrismicImageEvents, PrismicImageSlots> {
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import * as prismicT from "@prismicio/types";
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
field: prismicT.ImageField;
|
|
6
|
+
class: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
};
|
|
13
|
+
export declare type PrismicImageProps = typeof __propDef.props;
|
|
14
|
+
export declare type PrismicImageEvents = typeof __propDef.events;
|
|
15
|
+
export declare type PrismicImageSlots = typeof __propDef.slots;
|
|
16
|
+
export default class PrismicImage extends SvelteComponentTyped<PrismicImageProps, PrismicImageEvents, PrismicImageSlots> {
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
-
import { usePrismic } from "../usePrismic";
|
|
3
|
-
// const defaultBlankTargetRelAttribute = "noopener noreferrer";
|
|
4
|
-
export let field, linkResolver, download, hreflang, referrerpolicy, rel, target, type, prefetch, noscroll;
|
|
5
|
-
const setRel = () => {
|
|
6
|
-
let rels = [];
|
|
7
|
-
const defaultBlankTargetRelAttribute = ["noopener", "noreferrer"];
|
|
8
|
-
if (rel)
|
|
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 || "";
|
|
1
|
+
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
+
import { usePrismic } from "../usePrismic";
|
|
3
|
+
// const defaultBlankTargetRelAttribute = "noopener noreferrer";
|
|
4
|
+
export let field, linkResolver, download, hreflang, referrerpolicy, rel, target, type, prefetch, noscroll;
|
|
5
|
+
const setRel = () => {
|
|
6
|
+
let rels = [];
|
|
7
|
+
const defaultBlankTargetRelAttribute = ["noopener", "noreferrer"];
|
|
8
|
+
if (rel)
|
|
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 || "";
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<a
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import * as prismicH from "@prismicio/helpers";
|
|
3
|
-
import type * as prismicT from "@prismicio/types";
|
|
4
|
-
declare const __propDef: {
|
|
5
|
-
props: {
|
|
6
|
-
field: prismicT.LinkField | prismicT.PrismicDocument | null | undefined;
|
|
7
|
-
linkResolver: prismicH.LinkResolverFunction | null | undefined;
|
|
8
|
-
download: boolean | null | undefined;
|
|
9
|
-
hreflang: string | undefined;
|
|
10
|
-
referrerpolicy: string | undefined;
|
|
11
|
-
rel: string | undefined;
|
|
12
|
-
target: string | undefined;
|
|
13
|
-
type: string | undefined;
|
|
14
|
-
prefetch: true | undefined;
|
|
15
|
-
noscroll: true | undefined;
|
|
16
|
-
};
|
|
17
|
-
events: {
|
|
18
|
-
[evt: string]: CustomEvent<any>;
|
|
19
|
-
};
|
|
20
|
-
slots: {
|
|
21
|
-
default: {};
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare type PrismicLinkProps = typeof __propDef.props;
|
|
25
|
-
export declare type PrismicLinkEvents = typeof __propDef.events;
|
|
26
|
-
export declare type PrismicLinkSlots = typeof __propDef.slots;
|
|
27
|
-
export default class PrismicLink extends SvelteComponentTyped<PrismicLinkProps, PrismicLinkEvents, PrismicLinkSlots> {
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import * as prismicH from "@prismicio/helpers";
|
|
3
|
+
import type * as prismicT from "@prismicio/types";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
field: prismicT.LinkField | prismicT.PrismicDocument | null | undefined;
|
|
7
|
+
linkResolver: prismicH.LinkResolverFunction | null | undefined;
|
|
8
|
+
download: boolean | null | undefined;
|
|
9
|
+
hreflang: string | undefined;
|
|
10
|
+
referrerpolicy: string | undefined;
|
|
11
|
+
rel: string | undefined;
|
|
12
|
+
target: string | undefined;
|
|
13
|
+
type: string | undefined;
|
|
14
|
+
prefetch: true | undefined;
|
|
15
|
+
noscroll: true | undefined;
|
|
16
|
+
};
|
|
17
|
+
events: {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
};
|
|
20
|
+
slots: {
|
|
21
|
+
default: {};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare type PrismicLinkProps = typeof __propDef.props;
|
|
25
|
+
export declare type PrismicLinkEvents = typeof __propDef.events;
|
|
26
|
+
export declare type PrismicLinkSlots = typeof __propDef.slots;
|
|
27
|
+
export default class PrismicLink extends SvelteComponentTyped<PrismicLinkProps, PrismicLinkEvents, PrismicLinkSlots> {
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<script>import '@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({ documentID, defaultURL, previewToken, linkResolver });
|
|
13
|
-
await goto(redirect);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
console.log("Could not resolve preview URL.");
|
|
17
|
-
// TODO: Handle else
|
|
18
|
-
});
|
|
1
|
+
<script>import '@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({ documentID, defaultURL, previewToken, linkResolver });
|
|
13
|
+
await goto(redirect);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
console.log("Could not resolve preview URL.");
|
|
17
|
+
// TODO: Handle else
|
|
18
|
+
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<slot></slot>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
linkResolver: any;
|
|
5
|
-
defaultURL: string;
|
|
6
|
-
client: any;
|
|
7
|
-
};
|
|
8
|
-
events: {
|
|
9
|
-
[evt: string]: CustomEvent<any>;
|
|
10
|
-
};
|
|
11
|
-
slots: {
|
|
12
|
-
default: {};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export declare type PrismicPreviewProps = typeof __propDef.props;
|
|
16
|
-
export declare type PrismicPreviewEvents = typeof __propDef.events;
|
|
17
|
-
export declare type PrismicPreviewSlots = typeof __propDef.slots;
|
|
18
|
-
export default class PrismicPreview extends SvelteComponentTyped<PrismicPreviewProps, PrismicPreviewEvents, PrismicPreviewSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
linkResolver: any;
|
|
5
|
+
defaultURL: string;
|
|
6
|
+
client: any;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {
|
|
12
|
+
default: {};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type PrismicPreviewProps = typeof __propDef.props;
|
|
16
|
+
export declare type PrismicPreviewEvents = typeof __propDef.events;
|
|
17
|
+
export declare type PrismicPreviewSlots = typeof __propDef.slots;
|
|
18
|
+
export default class PrismicPreview extends SvelteComponentTyped<PrismicPreviewProps, PrismicPreviewEvents, PrismicPreviewSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
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 };
|
|
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
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{@html prismicH.asHTML(field, linkResolver, htmlSerializer)}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { RichTextField as RichTextFieldType } from "@prismicio/types";
|
|
3
|
-
import type { TitleField as TitleFieldType } from "@prismicio/types";
|
|
4
|
-
declare const __propDef: {
|
|
5
|
-
props: {
|
|
6
|
-
field: TitleFieldType | RichTextFieldType;
|
|
7
|
-
htmlSerializer?: any;
|
|
8
|
-
linkResolver?: any;
|
|
9
|
-
};
|
|
10
|
-
events: {
|
|
11
|
-
[evt: string]: CustomEvent<any>;
|
|
12
|
-
};
|
|
13
|
-
slots: {};
|
|
14
|
-
};
|
|
15
|
-
export declare type PrismicRichTextProps = typeof __propDef.props;
|
|
16
|
-
export declare type PrismicRichTextEvents = typeof __propDef.events;
|
|
17
|
-
export declare type PrismicRichTextSlots = typeof __propDef.slots;
|
|
18
|
-
export default class PrismicRichText extends SvelteComponentTyped<PrismicRichTextProps, PrismicRichTextEvents, PrismicRichTextSlots> {
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { RichTextField as RichTextFieldType } from "@prismicio/types";
|
|
3
|
+
import type { TitleField as TitleFieldType } from "@prismicio/types";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
field: TitleFieldType | RichTextFieldType;
|
|
7
|
+
htmlSerializer?: any;
|
|
8
|
+
linkResolver?: any;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
[evt: string]: CustomEvent<any>;
|
|
12
|
+
};
|
|
13
|
+
slots: {};
|
|
14
|
+
};
|
|
15
|
+
export declare type PrismicRichTextProps = typeof __propDef.props;
|
|
16
|
+
export declare type PrismicRichTextEvents = typeof __propDef.events;
|
|
17
|
+
export declare type PrismicRichTextSlots = typeof __propDef.slots;
|
|
18
|
+
export default class PrismicRichText extends SvelteComponentTyped<PrismicRichTextProps, PrismicRichTextEvents, PrismicRichTextSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
-
export let field;
|
|
3
|
-
export let separator;
|
|
1
|
+
<script>import * as prismicH from "@prismicio/helpers";
|
|
2
|
+
export let field;
|
|
3
|
+
export let separator;
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<!-- TODO: Separator not working for newlines `\n\n` -->
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { RichTextField as RichTextFieldType } from "@prismicio/types";
|
|
3
|
-
import type { TitleField as TitleFieldType } from "@prismicio/types";
|
|
4
|
-
declare const __propDef: {
|
|
5
|
-
props: {
|
|
6
|
-
field: TitleFieldType | RichTextFieldType;
|
|
7
|
-
separator: string;
|
|
8
|
-
};
|
|
9
|
-
events: {
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots: {};
|
|
13
|
-
};
|
|
14
|
-
export declare type PrismicTextProps = typeof __propDef.props;
|
|
15
|
-
export declare type PrismicTextEvents = typeof __propDef.events;
|
|
16
|
-
export declare type PrismicTextSlots = typeof __propDef.slots;
|
|
17
|
-
export default class PrismicText extends SvelteComponentTyped<PrismicTextProps, PrismicTextEvents, PrismicTextSlots> {
|
|
18
|
-
}
|
|
19
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { RichTextField as RichTextFieldType } from "@prismicio/types";
|
|
3
|
+
import type { TitleField as TitleFieldType } from "@prismicio/types";
|
|
4
|
+
declare const __propDef: {
|
|
5
|
+
props: {
|
|
6
|
+
field: TitleFieldType | RichTextFieldType;
|
|
7
|
+
separator: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
[evt: string]: CustomEvent<any>;
|
|
11
|
+
};
|
|
12
|
+
slots: {};
|
|
13
|
+
};
|
|
14
|
+
export declare type PrismicTextProps = typeof __propDef.props;
|
|
15
|
+
export declare type PrismicTextEvents = typeof __propDef.events;
|
|
16
|
+
export declare type PrismicTextSlots = typeof __propDef.slots;
|
|
17
|
+
export default class PrismicText extends SvelteComponentTyped<PrismicTextProps, PrismicTextEvents, PrismicTextSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script>import TodoSliceComponent from './TodoSliceComponent.svelte';
|
|
2
|
-
export let slices = [];
|
|
3
|
-
export let components = {};
|
|
4
|
-
export let context = {};
|
|
5
|
-
export let defaultComponent = undefined;
|
|
6
|
-
export let dev =
|
|
1
|
+
<script>import TodoSliceComponent from './TodoSliceComponent.svelte';
|
|
2
|
+
export let slices = [];
|
|
3
|
+
export let components = {};
|
|
4
|
+
export let context = {};
|
|
5
|
+
export let defaultComponent = undefined;
|
|
6
|
+
export let dev = false;
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
{#each slices as slice, index}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
import type { SvelteComponent } from 'svelte';
|
|
3
|
-
declare const __propDef: {
|
|
4
|
-
props: {
|
|
5
|
-
slices?: ({
|
|
6
|
-
slice_type: string;
|
|
7
|
-
} | {
|
|
8
|
-
type: string;
|
|
9
|
-
})[] | undefined;
|
|
10
|
-
components?: Record<string, SvelteComponent | (new (...args: any[]) => SvelteComponent)> | undefined;
|
|
11
|
-
context?: any;
|
|
12
|
-
defaultComponent?: SvelteComponent | (new (...args: any[]) => SvelteComponent) | undefined;
|
|
13
|
-
dev?: boolean | undefined;
|
|
14
|
-
};
|
|
15
|
-
events: {
|
|
16
|
-
[evt: string]: CustomEvent<any>;
|
|
17
|
-
};
|
|
18
|
-
slots: {};
|
|
19
|
-
};
|
|
20
|
-
export declare type SliceZoneProps = typeof __propDef.props;
|
|
21
|
-
export declare type SliceZoneEvents = typeof __propDef.events;
|
|
22
|
-
export declare type SliceZoneSlots = typeof __propDef.slots;
|
|
23
|
-
export default class SliceZone extends SvelteComponentTyped<SliceZoneProps, SliceZoneEvents, SliceZoneSlots> {
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SvelteComponent } from 'svelte';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
slices?: ({
|
|
6
|
+
slice_type: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: string;
|
|
9
|
+
})[] | undefined;
|
|
10
|
+
components?: Record<string, SvelteComponent | (new (...args: any[]) => SvelteComponent)> | undefined;
|
|
11
|
+
context?: any;
|
|
12
|
+
defaultComponent?: SvelteComponent | (new (...args: any[]) => SvelteComponent) | undefined;
|
|
13
|
+
dev?: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {};
|
|
19
|
+
};
|
|
20
|
+
export declare type SliceZoneProps = typeof __propDef.props;
|
|
21
|
+
export declare type SliceZoneEvents = typeof __propDef.events;
|
|
22
|
+
export declare type SliceZoneSlots = typeof __propDef.slots;
|
|
23
|
+
export default class SliceZone extends SvelteComponentTyped<SliceZoneProps, SliceZoneEvents, SliceZoneSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script>export let slice;
|
|
2
|
-
export let dev =
|
|
3
|
-
const type = "slice_type" in slice ? slice.slice_type : slice.type;
|
|
4
|
-
if (dev)
|
|
5
|
-
console.warn(`[SliceZone] Could not find a component for Slice type "${type}"`, slice);
|
|
1
|
+
<script>export let slice;
|
|
2
|
+
export let dev = false;
|
|
3
|
+
const type = "slice_type" in slice ? slice.slice_type : slice.type;
|
|
4
|
+
if (dev)
|
|
5
|
+
console.warn(`[SliceZone] Could not find a component for Slice type "${type}"`, slice);
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
{#if dev}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { SvelteComponentTyped } from "svelte";
|
|
2
|
-
declare const __propDef: {
|
|
3
|
-
props: {
|
|
4
|
-
slice: {
|
|
5
|
-
slice_type: string;
|
|
6
|
-
} | {
|
|
7
|
-
type: string;
|
|
8
|
-
};
|
|
9
|
-
dev?: boolean | undefined;
|
|
10
|
-
};
|
|
11
|
-
events: {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
};
|
|
14
|
-
slots: {};
|
|
15
|
-
};
|
|
16
|
-
export declare type TodoSliceComponentProps = typeof __propDef.props;
|
|
17
|
-
export declare type TodoSliceComponentEvents = typeof __propDef.events;
|
|
18
|
-
export declare type TodoSliceComponentSlots = typeof __propDef.slots;
|
|
19
|
-
export default class TodoSliceComponent extends SvelteComponentTyped<TodoSliceComponentProps, TodoSliceComponentEvents, TodoSliceComponentSlots> {
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
slice: {
|
|
5
|
+
slice_type: string;
|
|
6
|
+
} | {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
dev?: boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
};
|
|
16
|
+
export declare type TodoSliceComponentProps = typeof __propDef.props;
|
|
17
|
+
export declare type TodoSliceComponentEvents = typeof __propDef.events;
|
|
18
|
+
export declare type TodoSliceComponentSlots = typeof __propDef.slots;
|
|
19
|
+
export default class TodoSliceComponent extends SvelteComponentTyped<TodoSliceComponentProps, TodoSliceComponentEvents, TodoSliceComponentSlots> {
|
|
20
|
+
}
|
|
21
|
+
export {};
|
package/components/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as SliceZone } from "./SliceZone.svelte";
|
|
1
|
+
export { default as SliceZone } from "./SliceZone.svelte";
|
package/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// export { default as PrismicEmbed } from "./PrismicEmbed.svelte";
|
|
2
|
-
// export { default as PrismicImage } from "./PrismicImage.svelte";
|
|
3
|
-
// export { default as PrismicLink } from "./PrismicLink.svelte";
|
|
4
|
-
// export { default as PrismicText } from "./PrismicText.svelte";
|
|
5
|
-
// export { default as PrismicRichText } from "./PrismicRichText.svelte";
|
|
6
|
-
// export { default as PrismicPreview } from "./PrismicPreview.svelte";
|
|
7
|
-
export { default as SliceZone } from "./SliceZone.svelte";
|
|
1
|
+
// export { default as PrismicEmbed } from "./PrismicEmbed.svelte";
|
|
2
|
+
// export { default as PrismicImage } from "./PrismicImage.svelte";
|
|
3
|
+
// export { default as PrismicLink } from "./PrismicLink.svelte";
|
|
4
|
+
// export { default as PrismicText } from "./PrismicText.svelte";
|
|
5
|
+
// export { default as PrismicRichText } from "./PrismicRichText.svelte";
|
|
6
|
+
// export { default as PrismicPreview } from "./PrismicPreview.svelte";
|
|
7
|
+
export { default as SliceZone } from "./SliceZone.svelte";
|
package/configurePrismic.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
interface globalOptions {
|
|
2
|
-
repositoryName: string;
|
|
3
|
-
htmlSerializer?: any;
|
|
4
|
-
linkResolver?: any;
|
|
5
|
-
routes?: any;
|
|
6
|
-
slices?: any;
|
|
7
|
-
}
|
|
8
|
-
declare const configurePrismic: (globalOptions: globalOptions) => any;
|
|
9
|
-
export default configurePrismic;
|
|
1
|
+
interface globalOptions {
|
|
2
|
+
repositoryName: string;
|
|
3
|
+
htmlSerializer?: any;
|
|
4
|
+
linkResolver?: any;
|
|
5
|
+
routes?: any;
|
|
6
|
+
slices?: any;
|
|
7
|
+
}
|
|
8
|
+
declare const configurePrismic: (globalOptions: globalOptions) => any;
|
|
9
|
+
export default configurePrismic;
|
package/configurePrismic.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as prismic from "@prismicio/client";
|
|
2
|
-
import * as prismicH from "@prismicio/helpers";
|
|
3
|
-
const configurePrismic = (globalOptions) => {
|
|
4
|
-
const { repositoryName, htmlSerializer, linkResolver, slices } = globalOptions;
|
|
5
|
-
const endpoint = prismic.getEndpoint(repositoryName);
|
|
6
|
-
const client = prismic.createClient(endpoint, globalOptions);
|
|
7
|
-
const clientWithFetch = () => prismic.createClient(endpoint, { ...globalOptions, fetch });
|
|
8
|
-
return {
|
|
9
|
-
...prismicH,
|
|
10
|
-
client,
|
|
11
|
-
clientWithFetch,
|
|
12
|
-
htmlSerializer,
|
|
13
|
-
linkResolver,
|
|
14
|
-
slices,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export default configurePrismic;
|
|
1
|
+
import * as prismic from "@prismicio/client";
|
|
2
|
+
import * as prismicH from "@prismicio/helpers";
|
|
3
|
+
const configurePrismic = (globalOptions) => {
|
|
4
|
+
const { repositoryName, htmlSerializer, linkResolver, slices } = globalOptions;
|
|
5
|
+
const endpoint = prismic.getEndpoint(repositoryName);
|
|
6
|
+
const client = prismic.createClient(endpoint, globalOptions);
|
|
7
|
+
const clientWithFetch = () => prismic.createClient(endpoint, { ...globalOptions, fetch });
|
|
8
|
+
return {
|
|
9
|
+
...prismicH,
|
|
10
|
+
client,
|
|
11
|
+
clientWithFetch,
|
|
12
|
+
htmlSerializer,
|
|
13
|
+
linkResolver,
|
|
14
|
+
slices,
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default configurePrismic;
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SliceZone, } from "./components";
|
|
1
|
+
export { SliceZone, } from "./components";
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// export { default as configurePrismic } from "./configurePrismic";
|
|
2
|
-
export {
|
|
3
|
-
// Components
|
|
4
|
-
// PrismicEmbed,
|
|
5
|
-
// PrismicImage,
|
|
6
|
-
// PrismicLink,
|
|
7
|
-
// PrismicText,
|
|
8
|
-
// PrismicRichText,
|
|
9
|
-
// Slice Zone
|
|
10
|
-
SliceZone, } from "./components";
|
|
11
|
-
// export { default as PrismicProvider } from "./PrismicProvider.svelte";
|
|
12
|
-
// export { usePrismic } from "./usePrismic";
|
|
13
|
-
// export type { PrismicContext } from "./types";
|
|
1
|
+
// export { default as configurePrismic } from "./configurePrismic";
|
|
2
|
+
export {
|
|
3
|
+
// Components
|
|
4
|
+
// PrismicEmbed,
|
|
5
|
+
// PrismicImage,
|
|
6
|
+
// PrismicLink,
|
|
7
|
+
// PrismicText,
|
|
8
|
+
// PrismicRichText,
|
|
9
|
+
// Slice Zone
|
|
10
|
+
SliceZone, } from "./components";
|
|
11
|
+
// export { default as PrismicProvider } from "./PrismicProvider.svelte";
|
|
12
|
+
// export { usePrismic } from "./usePrismic";
|
|
13
|
+
// export type { PrismicContext } from "./types";
|
package/injectionSymbols.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const prismicKey: unique symbol;
|
|
1
|
+
export declare const prismicKey: unique symbol;
|
package/injectionSymbols.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const prismicKey = Symbol("prismic");
|
|
1
|
+
export const prismicKey = Symbol("prismic");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/svelte",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Svelte plugin, components, and composables to fetch and present Prismic content",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
"./package.json": "./package.json",
|
|
18
18
|
".": "./index.js",
|
|
19
|
-
"./
|
|
19
|
+
"./PrismicProvider.svelte": "./PrismicProvider.svelte",
|
|
20
20
|
"./components/PrismicEmbed.svelte": "./components/PrismicEmbed.svelte",
|
|
21
21
|
"./components/PrismicImage.svelte": "./components/PrismicImage.svelte",
|
|
22
22
|
"./components/PrismicLink.svelte": "./components/PrismicLink.svelte",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"./components/PrismicText.svelte": "./components/PrismicText.svelte",
|
|
26
26
|
"./components/SliceZone.svelte": "./components/SliceZone.svelte",
|
|
27
27
|
"./components/TodoSliceComponent.svelte": "./components/TodoSliceComponent.svelte",
|
|
28
|
+
"./components": "./components/index.js",
|
|
28
29
|
"./configurePrismic": "./configurePrismic.js",
|
|
29
30
|
"./injectionSymbols": "./injectionSymbols.js",
|
|
30
|
-
"./PrismicProvider.svelte": "./PrismicProvider.svelte",
|
|
31
31
|
"./types": "./types.js",
|
|
32
32
|
"./usePrismic": "./usePrismic.js"
|
|
33
33
|
},
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"svelte-check": "^2.7.0",
|
|
61
61
|
"svelte-preprocess": "^4.10.6",
|
|
62
62
|
"svelte2tsx": "^0.5.9",
|
|
63
|
-
"ts-eager": "^2.0.2",
|
|
64
63
|
"tslib": "^2.4.0",
|
|
65
64
|
"typescript": "^4.6.4",
|
|
66
65
|
"vitest": "^0.12.4"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
export let components:SliceComponents = {}
|
|
48
48
|
export let context:any = {}
|
|
49
49
|
export let defaultComponent:SvelteComponent | (new (...args: any[]) => SvelteComponent) | undefined = undefined
|
|
50
|
-
export let dev:boolean =
|
|
50
|
+
export let dev:boolean = false
|
|
51
51
|
</script>
|
|
52
52
|
|
|
53
53
|
{#each slices as slice, index}
|
package/types.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { Client } from "@prismicio/client";
|
|
2
|
-
import type { LinkResolverFunction, HTMLFunctionSerializer, HTMLMapSerializer } from "@prismicio/helpers";
|
|
3
|
-
export interface Route {
|
|
4
|
-
/**
|
|
5
|
-
* The Custom Type of the document.
|
|
6
|
-
*/
|
|
7
|
-
type: string;
|
|
8
|
-
/**
|
|
9
|
-
* The resolved path of the document with optional placeholders.
|
|
10
|
-
*/
|
|
11
|
-
path: string;
|
|
12
|
-
/**
|
|
13
|
-
* An object that lists the API IDs of the Content Relationships in the route.
|
|
14
|
-
*/
|
|
15
|
-
resolvers: Record<string, string>;
|
|
16
|
-
}
|
|
17
|
-
export interface PrismicConfig {
|
|
18
|
-
repoName: string;
|
|
19
|
-
routes?: Route[];
|
|
20
|
-
accessToken?: string;
|
|
21
|
-
options?: null;
|
|
22
|
-
}
|
|
23
|
-
export declare type PrismicContext = {
|
|
24
|
-
client?: Client;
|
|
25
|
-
linkResolver?: LinkResolverFunction;
|
|
26
|
-
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
27
|
-
};
|
|
1
|
+
import type { Client } from "@prismicio/client";
|
|
2
|
+
import type { LinkResolverFunction, HTMLFunctionSerializer, HTMLMapSerializer } from "@prismicio/helpers";
|
|
3
|
+
export interface Route {
|
|
4
|
+
/**
|
|
5
|
+
* The Custom Type of the document.
|
|
6
|
+
*/
|
|
7
|
+
type: string;
|
|
8
|
+
/**
|
|
9
|
+
* The resolved path of the document with optional placeholders.
|
|
10
|
+
*/
|
|
11
|
+
path: string;
|
|
12
|
+
/**
|
|
13
|
+
* An object that lists the API IDs of the Content Relationships in the route.
|
|
14
|
+
*/
|
|
15
|
+
resolvers: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
export interface PrismicConfig {
|
|
18
|
+
repoName: string;
|
|
19
|
+
routes?: Route[];
|
|
20
|
+
accessToken?: string;
|
|
21
|
+
options?: null;
|
|
22
|
+
}
|
|
23
|
+
export declare type PrismicContext = {
|
|
24
|
+
client?: Client;
|
|
25
|
+
linkResolver?: LinkResolverFunction;
|
|
26
|
+
htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
|
|
27
|
+
};
|
package/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/usePrismic.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { PrismicContext } from "./types";
|
|
2
|
-
export declare const usePrismic: () => PrismicContext;
|
|
1
|
+
import { PrismicContext } from "./types";
|
|
2
|
+
export declare const usePrismic: () => PrismicContext;
|
package/usePrismic.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { hasContext, getContext } from "svelte";
|
|
2
|
-
import { prismicKey } from "./injectionSymbols";
|
|
3
|
-
import "./types";
|
|
4
|
-
export const usePrismic = () => {
|
|
5
|
-
if (hasContext(prismicKey)) {
|
|
6
|
-
return getContext(prismicKey);
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
};
|
|
1
|
+
import { hasContext, getContext } from "svelte";
|
|
2
|
+
import { prismicKey } from "./injectionSymbols";
|
|
3
|
+
import "./types";
|
|
4
|
+
export const usePrismic = () => {
|
|
5
|
+
if (hasContext(prismicKey)) {
|
|
6
|
+
return getContext(prismicKey);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
};
|