@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +42 -32
  2. package/PrismicProvider.svelte +1 -2
  3. package/components/PrismicEmbed.svelte +8 -4
  4. package/components/PrismicImage.svelte +9 -16
  5. package/components/PrismicLink.svelte +20 -39
  6. package/components/PrismicPreview.svelte +9 -4
  7. package/components/PrismicText.svelte +1 -1
  8. package/components/SliceZone.svelte +8 -8
  9. package/components/TodoSliceComponent.svelte +4 -4
  10. package/components/index.js +1 -1
  11. package/index.js +1 -1
  12. package/{PrismicProvider.svelte.d.ts → lib/PrismicProvider.svelte.d.ts} +3 -3
  13. package/{components → lib/components}/PrismicEmbed.svelte.d.ts +3 -3
  14. package/{components → lib/components}/PrismicImage.svelte.d.ts +4 -4
  15. package/lib/components/PrismicLink.svelte.d.ts +26 -0
  16. package/{components → lib/components}/PrismicPreview.svelte.d.ts +3 -3
  17. package/{components → lib/components}/PrismicRichText.svelte.d.ts +3 -3
  18. package/{components → lib/components}/PrismicText.svelte.d.ts +3 -3
  19. package/{components → lib/components}/SliceZone.svelte.d.ts +4 -4
  20. package/{components → lib/components}/TodoSliceComponent.svelte.d.ts +3 -3
  21. package/lib/components/index.d.ts +2 -0
  22. package/lib/index.d.ts +1 -0
  23. package/lib/usePrismic.d.ts +2 -0
  24. package/package.json +25 -20
  25. package/src/app.html +2 -2
  26. package/src/lib/PrismicProvider.svelte +3 -3
  27. package/src/lib/components/PrismicEmbed.svelte +10 -5
  28. package/src/lib/components/PrismicImage.svelte +12 -26
  29. package/src/lib/components/PrismicLink.svelte +39 -54
  30. package/src/lib/components/PrismicPreview.svelte +24 -19
  31. package/src/lib/components/PrismicRichText.svelte +7 -7
  32. package/src/lib/components/PrismicText.svelte +6 -6
  33. package/src/lib/components/SliceZone.svelte +55 -50
  34. package/src/lib/components/TodoSliceComponent.svelte +12 -11
  35. package/src/lib/components/index.ts +1 -1
  36. package/src/lib/index.ts +1 -1
  37. package/src/lib/usePrismic.ts +1 -1
  38. package/src/routes/+page.server.ts +20 -0
  39. package/src/routes/+page.svelte +35 -0
  40. package/src/routes/slices/CodeSnippet/index.svelte +19 -0
  41. package/src/routes/slices/RichText/index.svelte +8 -0
  42. package/src/routes/slices/index.ts +2 -2
  43. package/src/types/CodeSnippetSlice.type.ts +7 -0
  44. package/src/types/ExampleDocument.type.ts +6 -0
  45. package/src/types/PageDocument.type.ts +7 -0
  46. package/src/types/PrismicConfig.type.ts +8 -0
  47. package/src/types/PrismicContext.type.ts +13 -0
  48. package/src/types/RichTextSlice.type.ts +7 -0
  49. package/src/types/Route.type.ts +14 -0
  50. package/src/types/index.ts +7 -0
  51. package/types/PrismicContext.type.d.ts +7 -0
  52. package/usePrismic.js +0 -1
  53. package/components/PrismicLink.svelte.d.ts +0 -29
  54. package/components/index.d.ts +0 -1
  55. package/index.d.ts +0 -1
  56. package/src/lib/types.ts +0 -35
  57. package/src/routes/index.svelte +0 -26
  58. package/src/routes/index.ts +0 -15
  59. package/src/routes/slices/CodeSnippet.svelte +0 -19
  60. package/src/routes/slices/RichText.svelte +0 -8
  61. package/types.d.ts +0 -27
  62. package/types.js +0 -1
  63. package/usePrismic.d.ts +0 -2
  64. /package/{configurePrismic.d.ts → lib/configurePrismic.d.ts} +0 -0
  65. /package/{injectionSymbols.d.ts → lib/injectionSymbols.d.ts} +0 -0
@@ -1,29 +0,0 @@
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 +0,0 @@
1
- export { default as SliceZone } from "./SliceZone.svelte";
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { SliceZone, } from "./components";
package/src/lib/types.ts DELETED
@@ -1,35 +0,0 @@
1
- import type { Client } from "@prismicio/client";
2
- import type {
3
- LinkResolverFunction,
4
- HTMLFunctionSerializer,
5
- HTMLMapSerializer,
6
- } from "@prismicio/helpers";
7
- // import type * as prismicH from "@prismicio/helpers";
8
-
9
- export interface Route {
10
- /**
11
- * The Custom Type of the document.
12
- */
13
- type: string;
14
- /**
15
- * The resolved path of the document with optional placeholders.
16
- */
17
- path: string;
18
- /**
19
- * An object that lists the API IDs of the Content Relationships in the route.
20
- */
21
- resolvers: Record<string, string>;
22
- }
23
-
24
- export interface PrismicConfig {
25
- repoName: string;
26
- routes?: Route[];
27
- accessToken?: string;
28
- options?: null;
29
- }
30
-
31
- export type PrismicContext = {
32
- client?: Client;
33
- linkResolver?: LinkResolverFunction;
34
- htmlSerializer?: HTMLFunctionSerializer | HTMLMapSerializer;
35
- };
@@ -1,26 +0,0 @@
1
- <script context="module" lang="ts">
2
- import type * as prismicT from "@prismicio/types"
3
- import { SliceZone } from "$lib";
4
- import {RichText, CodeSnippet} from "./slices"
5
-
6
- const components = {
7
- rich_text: RichText,
8
- code_snippet: CodeSnippet
9
- }
10
- </script>
11
-
12
- <script lang="ts">
13
- export let document:prismicT.PrismicDocument
14
- </script>
15
-
16
- <main>
17
- <h1>Welcome to SvelteKit</h1>
18
- <SliceZone slices={document.data.body} {components} />
19
- </main>
20
-
21
- <style>
22
- main {
23
- max-width: min(90%, 800px);
24
- margin: auto;
25
- }
26
- </style>
@@ -1,15 +0,0 @@
1
- import * as prismic from "@prismicio/client";
2
- import type * as prismicT from "@prismicio/types";
3
-
4
- export async function get({ fetch }) {
5
- const endpoint = prismic.getEndpoint("svelte-package-dev");
6
- const client = prismic.createClient(endpoint, { fetch });
7
-
8
- const document: prismicT.PrismicDocument = await client.getSingle("homepage");
9
-
10
- return {
11
- body: {
12
- document,
13
- },
14
- };
15
- }
@@ -1,19 +0,0 @@
1
- <script lang="ts">
2
- import * as prismicH from "@prismicio/helpers"
3
- import type * as prismicT from "@prismicio/types"
4
-
5
- export let slice:prismicT.Slice
6
- </script>
7
-
8
- <pre>
9
- {@html prismicH.asHTML(slice.primary.content)}
10
- </pre>
11
-
12
- <style>
13
- pre {
14
- background: #222;
15
- color: white;
16
- padding: 10px;
17
- border-radius: 10px;
18
- }
19
- </style>
@@ -1,8 +0,0 @@
1
- <script lang="ts">
2
- import * as prismicH from "@prismicio/helpers"
3
- import type * as prismicT from "@prismicio/types"
4
-
5
- export let slice:prismicT.Slice
6
- </script>
7
-
8
- {@html prismicH.asHTML(slice.primary.content)}
package/types.d.ts DELETED
@@ -1,27 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- export {};
package/usePrismic.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { PrismicContext } from "./types";
2
- export declare const usePrismic: () => PrismicContext;