@prismicio/svelte 2.2.2 → 2.2.3-pr.64.93e3b65

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 (50) hide show
  1. package/dist/PrismicEmbed.svelte +6 -8
  2. package/dist/PrismicEmbed.svelte.d.ts +1 -3
  3. package/dist/PrismicImage.svelte +46 -68
  4. package/dist/PrismicImage.svelte.d.ts +11 -17
  5. package/dist/PrismicLink.svelte +23 -34
  6. package/dist/PrismicLink.svelte.d.ts +5 -10
  7. package/dist/PrismicRichText/DefaultComponent.svelte +9 -13
  8. package/dist/PrismicRichText/PrismicRichText.svelte +11 -16
  9. package/dist/PrismicRichText/PrismicRichText.svelte.d.ts +2 -6
  10. package/dist/PrismicRichText/Serialize.svelte +11 -19
  11. package/dist/PrismicTable.svelte +21 -41
  12. package/dist/PrismicTable.svelte.d.ts +4 -8
  13. package/dist/PrismicText.svelte +16 -20
  14. package/dist/PrismicText.svelte.d.ts +4 -8
  15. package/dist/SliceSimulator.svelte +31 -18
  16. package/dist/SliceSimulator.svelte.d.ts +13 -34
  17. package/dist/SliceZone/SliceZone.svelte +21 -26
  18. package/dist/SliceZone/SliceZone.svelte.d.ts +12 -16
  19. package/dist/SliceZone/TodoComponent.svelte +7 -7
  20. package/dist/index.d.ts +1 -3
  21. package/dist/kit/PrismicPreview.svelte +37 -52
  22. package/dist/kit/PrismicPreview.svelte.d.ts +5 -9
  23. package/dist/kit/enableAutoPreviews.d.ts +5 -10
  24. package/dist/kit/enableAutoPreviews.js +1 -2
  25. package/dist/kit/redirectToPreviewURL.d.ts +13 -21
  26. package/dist/kit/redirectToPreviewURL.js +10 -11
  27. package/dist/kit/types.d.ts +3 -6
  28. package/dist/lib/devMsg.d.ts +6 -8
  29. package/dist/lib/devMsg.js +6 -8
  30. package/dist/types.d.ts +23 -39
  31. package/package.json +43 -46
  32. package/src/PrismicEmbed.svelte +6 -8
  33. package/src/PrismicImage.svelte +46 -68
  34. package/src/PrismicLink.svelte +23 -34
  35. package/src/PrismicRichText/DefaultComponent.svelte +9 -13
  36. package/src/PrismicRichText/PrismicRichText.svelte +11 -16
  37. package/src/PrismicRichText/Serialize.svelte +11 -19
  38. package/src/PrismicTable.svelte +21 -41
  39. package/src/PrismicText.svelte +16 -20
  40. package/src/SliceSimulator.svelte +31 -18
  41. package/src/SliceZone/SliceZone.svelte +21 -26
  42. package/src/SliceZone/TodoComponent.svelte +7 -7
  43. package/src/index.ts +13 -15
  44. package/src/kit/PrismicPreview.svelte +37 -52
  45. package/src/kit/enableAutoPreviews.ts +14 -19
  46. package/src/kit/index.ts +6 -6
  47. package/src/kit/redirectToPreviewURL.ts +28 -38
  48. package/src/kit/types.ts +7 -10
  49. package/src/lib/devMsg.ts +9 -11
  50. package/src/types.ts +84 -106
@@ -1,29 +1,25 @@
1
1
  <script lang="ts">
2
- import type { RichTextField } from "@prismicio/client";
3
- import { asText, isFilled } from "@prismicio/client";
4
- import { DEV } from "esm-env";
2
+ import type { RichTextField } from "@prismicio/client"
3
+ import { asText, isFilled } from "@prismicio/client"
4
+ import { DEV } from "esm-env"
5
5
 
6
- import { devMsg } from "./lib/devMsg";
6
+ import { devMsg } from "./lib/devMsg"
7
7
 
8
8
  type Props = {
9
- /**
10
- * A Rich Text or Title field from Prismic.
11
- */
12
- field: RichTextField;
9
+ /** A Rich Text or Title field from Prismic. */
10
+ field: RichTextField
13
11
 
14
- /**
15
- * The separator used between blocks. Defaults to `\n`.
16
- */
17
- separator?: string | undefined;
12
+ /** The separator used between blocks. Defaults to `\n`. */
13
+ separator?: string | undefined
18
14
 
19
15
  /**
20
- * The string rendered when the field is empty. If a fallback is not given,
21
- * `null` will be rendered.
16
+ * The string rendered when the field is empty. If a fallback is not given, `null` will be
17
+ * rendered.
22
18
  */
23
- fallback?: string | undefined;
24
- };
19
+ fallback?: string | undefined
20
+ }
25
21
 
26
- const { field, separator, fallback, ...restProps }: Props = $props();
22
+ const { field, separator, fallback, ...restProps }: Props = $props()
27
23
 
28
24
  $effect(() => {
29
25
  if (DEV) {
@@ -33,10 +29,10 @@
33
29
  "classname-is-not-a-valid-prop",
34
30
  )}.`,
35
31
  $state.snapshot(field),
36
- );
32
+ )
37
33
  }
38
34
  }
39
- });
35
+ })
40
36
 
41
37
  if (DEV) {
42
38
  if (typeof field === "string") {
@@ -44,7 +40,7 @@
44
40
  `[PrismicText] The "field" prop only accepts a Rich Text or Title field's value but was provided a different type of field instead (e.g. a Key Text or Select field). You can resolve this error by rendering the field value inline without <PrismicText>. For more details, see ${devMsg(
45
41
  "prismictext-works-only-with-rich-text-and-title-fields",
46
42
  )}`,
47
- );
43
+ )
48
44
  }
49
45
  }
50
46
  </script>
@@ -1,16 +1,12 @@
1
1
  import type { RichTextField } from "@prismicio/client";
2
2
  type Props = {
3
- /**
4
- * A Rich Text or Title field from Prismic.
5
- */
3
+ /** A Rich Text or Title field from Prismic. */
6
4
  field: RichTextField;
7
- /**
8
- * The separator used between blocks. Defaults to `\n`.
9
- */
5
+ /** The separator used between blocks. Defaults to `\n`. */
10
6
  separator?: string | undefined;
11
7
  /**
12
- * The string rendered when the field is empty. If a fallback is not given,
13
- * `null` will be rendered.
8
+ * The string rendered when the field is empty. If a fallback is not given, `null` will be
9
+ * rendered.
14
10
  */
15
11
  fallback?: string | undefined;
16
12
  };
@@ -9,40 +9,53 @@
9
9
  onClickHandler,
10
10
  simulatorClass,
11
11
  simulatorRootClass,
12
- } from "@prismicio/simulator/kit";
12
+ } from "@prismicio/simulator/kit"
13
+ import type { Snippet } from "svelte"
14
+ import type { ClassValue } from "svelte/elements"
13
15
 
14
- const defaultProps = getDefaultProps();
16
+ const defaultProps = getDefaultProps()
15
17
 
16
- export let zIndex = defaultProps.zIndex;
17
- export let background = defaultProps.background;
18
+ type Props = {
19
+ zIndex?: number
20
+ background?: string
21
+ class?: ClassValue
22
+ children?: Snippet<[{ slices: ReturnType<typeof getDefaultSlices> }]>
23
+ }
24
+
25
+ const {
26
+ zIndex = defaultProps.zIndex,
27
+ background = defaultProps.background,
28
+ class: className,
29
+ children,
30
+ }: Props = $props()
18
31
 
19
- let slices = getDefaultSlices();
20
- let message = getDefaultMessage();
32
+ let slices = $state.raw(getDefaultSlices())
33
+ let message = $state(getDefaultMessage())
21
34
 
22
35
  if (typeof window !== "undefined") {
23
- const simulatorManager = new SimulatorManager();
36
+ const simulatorManager = new SimulatorManager()
24
37
 
25
38
  simulatorManager.state.on(
26
39
  StateEventType.Slices,
27
40
  (newSlices) => {
28
- slices = newSlices;
41
+ slices = newSlices
29
42
  },
30
43
  "simulator-slices",
31
- );
44
+ )
32
45
  simulatorManager.state.on(
33
46
  StateEventType.Message,
34
47
  (newMessage) => {
35
- message = newMessage;
48
+ message = newMessage
36
49
  },
37
50
  "simulator-message",
38
- );
51
+ )
39
52
 
40
- simulatorManager.init();
53
+ simulatorManager.init()
41
54
  }
42
55
  </script>
43
56
 
44
57
  <div
45
- class="{simulatorClass} {$$props.class}"
58
+ class={[simulatorClass, className]}
46
59
  style="z-index: {zIndex}; position: fixed; top: 0; left: 0; width: 100%; height: 100vh; overflow: auto; background: {background}"
47
60
  >
48
61
  {#if message}
@@ -51,15 +64,15 @@
51
64
  {@html message}
52
65
  </article>
53
66
  {:else if slices.length}
54
- <!-- svelte-ignore a11y-no-static-element-interactions -->
67
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
55
68
  <div
56
69
  id="root"
57
70
  class={simulatorRootClass}
58
- on:click={onClickHandler}
59
- on:submit={disableEventHandler}
60
- on:keypress={disableEventHandler}
71
+ onclick={onClickHandler}
72
+ onsubmit={disableEventHandler}
73
+ onkeypress={disableEventHandler}
61
74
  >
62
- <slot {slices} />
75
+ {@render children?.({ slices })}
63
76
  </div>
64
77
  {/if}
65
78
  </div>
@@ -1,35 +1,14 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: Props & {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
15
- default: any;
16
- } ? Props extends Record<string, never> ? any : {
17
- children?: any;
18
- } : {});
19
- declare const SliceSimulator: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
20
- [x: string]: any;
21
- zIndex?: number | undefined;
22
- background?: string | undefined;
23
- }, {
24
- default: {
25
- slices: import("@prismicio/client").SliceZone;
26
- };
27
- }>, {
28
- [evt: string]: CustomEvent<any>;
29
- }, {
30
- default: {
31
- slices: import("@prismicio/client").SliceZone;
32
- };
33
- }, {}, string>;
34
- type SliceSimulator = InstanceType<typeof SliceSimulator>;
1
+ import { getDefaultSlices } from "@prismicio/simulator/kit";
2
+ import type { Snippet } from "svelte";
3
+ import type { ClassValue } from "svelte/elements";
4
+ type Props = {
5
+ zIndex?: number;
6
+ background?: string;
7
+ class?: ClassValue;
8
+ children?: Snippet<[{
9
+ slices: ReturnType<typeof getDefaultSlices>;
10
+ }]>;
11
+ };
12
+ declare const SliceSimulator: import("svelte").Component<Props, {}, "">;
13
+ type SliceSimulator = ReturnType<typeof SliceSimulator>;
35
14
  export default SliceSimulator;
@@ -1,54 +1,49 @@
1
1
  <script lang="ts">
2
- import type { Component } from "svelte";
2
+ import type { Component } from "svelte"
3
3
 
4
- import type { SliceComponentProps, SliceZoneLike } from "../types";
5
-
6
- import TodoComponent from "./TodoComponent.svelte";
4
+ import type { SliceComponentProps, SliceZoneLike } from "../types"
5
+ import TodoComponent from "./TodoComponent.svelte"
7
6
 
8
7
  type Props = {
9
- /**
10
- * An array of Prismic Slices, such as the `slices` property from a Prismic
11
- * document.
12
- */
13
- slices?: SliceZoneLike;
8
+ /** An array of Prismic Slices, such as the `slices` property from a Prismic document. */
9
+ slices?: SliceZoneLike
14
10
 
15
11
  /**
16
12
  * An object that maps Slice components to their corresponding API IDs.
17
13
  *
18
- * @example An example map:
14
+ * @example
15
+ * An example map:
19
16
  *
20
- * ```js
21
- * import BlockQuote from "./BlockQuote.svelte";
22
- * import HeroImage from "./HeroImage.svelte";
17
+ * ```js
18
+ * import BlockQuote from "./BlockQuote.svelte";
19
+ * import HeroImage from "./HeroImage.svelte";
23
20
  *
24
- * const components = {
21
+ * const components = {
25
22
  * block_quote: BlockQuote,
26
23
  * hero_image: HeroImage,
27
- * };
28
- * ```
24
+ * };
25
+ * ```
29
26
  */
30
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
- components?: Record<string, Component<any>>;
28
+ components?: Record<string, Component<any>>
32
29
 
33
- /**
34
- * Arbitrary data passed to all Slice components as a `context` prop.
35
- */
30
+ /** Arbitrary data passed to all Slice components as a `context` prop. */
36
31
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- context?: any;
32
+ context?: any
38
33
 
39
34
  /**
40
- * The Svelte component rendered if a component mapping from the
41
- * `components` prop cannot be found.
35
+ * The Svelte component rendered if a component mapping from the `components` prop cannot be
36
+ * found.
42
37
  */
43
- defaultComponent?: Component<SliceComponentProps> | undefined;
44
- };
38
+ defaultComponent?: Component<SliceComponentProps> | undefined
39
+ }
45
40
 
46
41
  const {
47
42
  slices = [],
48
43
  components = {},
49
44
  context = {},
50
45
  defaultComponent = undefined,
51
- }: Props = $props();
46
+ }: Props = $props()
52
47
  </script>
53
48
 
54
49
  <!--
@@ -1,34 +1,30 @@
1
1
  import type { Component } from "svelte";
2
2
  import type { SliceComponentProps, SliceZoneLike } from "../types";
3
3
  type Props = {
4
- /**
5
- * An array of Prismic Slices, such as the `slices` property from a Prismic
6
- * document.
7
- */
4
+ /** An array of Prismic Slices, such as the `slices` property from a Prismic document. */
8
5
  slices?: SliceZoneLike;
9
6
  /**
10
7
  * An object that maps Slice components to their corresponding API IDs.
11
8
  *
12
- * @example An example map:
9
+ * @example
10
+ * An example map:
13
11
  *
14
- * ```js
15
- * import BlockQuote from "./BlockQuote.svelte";
16
- * import HeroImage from "./HeroImage.svelte";
12
+ * ```js
13
+ * import BlockQuote from "./BlockQuote.svelte";
14
+ * import HeroImage from "./HeroImage.svelte";
17
15
  *
18
- * const components = {
16
+ * const components = {
19
17
  * block_quote: BlockQuote,
20
18
  * hero_image: HeroImage,
21
- * };
22
- * ```
19
+ * };
20
+ * ```
23
21
  */
24
22
  components?: Record<string, Component<any>>;
25
- /**
26
- * Arbitrary data passed to all Slice components as a `context` prop.
27
- */
23
+ /** Arbitrary data passed to all Slice components as a `context` prop. */
28
24
  context?: any;
29
25
  /**
30
- * The Svelte component rendered if a component mapping from the
31
- * `components` prop cannot be found.
26
+ * The Svelte component rendered if a component mapping from the `components` prop cannot be
27
+ * found.
32
28
  */
33
29
  defaultComponent?: Component<SliceComponentProps> | undefined;
34
30
  };
@@ -1,22 +1,22 @@
1
1
  <script lang="ts">
2
- import { DEV } from "esm-env";
2
+ import { DEV } from "esm-env"
3
3
 
4
4
  type Props = {
5
- slice: { slice_type: string } | { type: string };
6
- };
5
+ slice: { slice_type: string } | { type: string }
6
+ }
7
7
 
8
- const { slice }: Props = $props();
8
+ const { slice }: Props = $props()
9
9
 
10
- const type = $derived("slice_type" in slice ? slice.slice_type : slice.type);
10
+ const type = $derived("slice_type" in slice ? slice.slice_type : slice.type)
11
11
 
12
12
  $effect(() => {
13
13
  if (DEV) {
14
14
  console.warn(
15
15
  `[SliceZone] Could not find a component for Slice type "${type}"`,
16
16
  $state.snapshot(slice),
17
- );
17
+ )
18
18
  }
19
- });
19
+ })
20
20
  </script>
21
21
 
22
22
  {#if DEV}
package/dist/index.d.ts CHANGED
@@ -7,9 +7,7 @@ export { default as PrismicTable } from "./PrismicTable.svelte";
7
7
  export { default as PrismicText } from "./PrismicText.svelte";
8
8
  export { default as SliceZone } from "./SliceZone/SliceZone.svelte";
9
9
  export { default as SliceSimulator } from "./SliceSimulator.svelte";
10
- /**
11
- * @deprecated Replaced with `RichTextComponents`
12
- */
10
+ /** @deprecated Replaced with `RichTextComponents` */
13
11
  export type SvelteRichTextSerializer = RichTextComponents;
14
12
  export type { RichTextComponents };
15
13
  export type { RichTextComponentProps, SliceComponentProps } from "./types";
@@ -1,62 +1,52 @@
1
1
  <script lang="ts">
2
- import { beforeNavigate, goto, invalidateAll } from "$app/navigation";
3
- import { getToolbarSrc } from "@prismicio/client";
4
- import { onMount } from "svelte";
2
+ import { beforeNavigate, goto, refreshAll } from "$app/navigation"
3
+ import { getToolbarSrc } from "@prismicio/client"
4
+ import { VERSION } from "@sveltejs/kit"
5
+ import { onMount } from "svelte"
5
6
 
6
7
  type Props = {
7
8
  /**
8
- * The name of your Prismic repository. A Prismic Toolbar will be registered
9
- * using this repository.
9
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
10
+ * repository.
10
11
  */
11
- repositoryName: string;
12
+ repositoryName: string
12
13
 
13
- /**
14
- * The route parameter prefixed during preview sessions.
15
- */
16
- routePrefix?: string;
14
+ /** The route parameter prefixed during preview sessions. */
15
+ routePrefix?: string
17
16
 
18
17
  /**
19
- * The name of the preview-specific route parameter prefixed during preview
20
- * sessions.
18
+ * The name of the preview-specific route parameter prefixed during preview sessions.
21
19
  *
22
- * Only set this value if the route parameter's name differs from the
23
- * parameter's value.
20
+ * Only set this value if the route parameter's name differs from the parameter's value.
24
21
  */
25
- routePrefixName?: string;
26
- };
22
+ routePrefixName?: string
23
+ }
27
24
 
28
- const {
29
- repositoryName,
30
- routePrefix = "preview",
31
- routePrefixName = routePrefix,
32
- }: Props = $props();
25
+ const { repositoryName, routePrefix = "preview", routePrefixName = routePrefix }: Props = $props()
33
26
 
34
- const toolbarSrc = $derived(getToolbarSrc(repositoryName));
27
+ const toolbarSrc = $derived(getToolbarSrc(repositoryName))
35
28
 
36
- /**
37
- * Set to `true` when the next `beforeNavigate()` call should not prefix the
38
- * route.
39
- */
40
- let endingPreview = $state(false);
29
+ /** Set to `true` when the next `beforeNavigate()` call should not prefix the route. */
30
+ let endingPreview = $state(false)
41
31
 
42
32
  // Register Prismic toolbar event handlers to refresh data on content updates.
43
33
  onMount(() => {
44
- const controller = new AbortController();
34
+ const controller = new AbortController()
45
35
 
46
36
  window.addEventListener(
47
37
  "prismicPreviewUpdate",
48
38
  (event) => {
49
- event.preventDefault();
50
- invalidateAll();
39
+ event.preventDefault()
40
+ refreshAll()
51
41
  },
52
42
  { signal: controller.signal },
53
- );
43
+ )
54
44
  window.addEventListener(
55
45
  "prismicPreviewEnd",
56
46
  (event) => {
57
- event.preventDefault();
47
+ event.preventDefault()
58
48
 
59
- endingPreview = true;
49
+ endingPreview = true
60
50
 
61
51
  goto(
62
52
  new URL(
@@ -66,19 +56,19 @@
66
56
  ),
67
57
  window.location.origin,
68
58
  ),
69
- {
70
- invalidateAll: true,
71
- noScroll: true,
72
- },
73
- );
59
+ // SvelteKit 3 replaced `noScroll` with `reset` and throws on `noScroll`.
60
+ (VERSION.startsWith("2.")
61
+ ? { invalidateAll: true, noScroll: true }
62
+ : { refreshAll: true, reset: false }) as Parameters<typeof goto>[1],
63
+ )
74
64
  },
75
65
  { signal: controller.signal },
76
- );
66
+ )
77
67
 
78
68
  return () => {
79
- controller.abort();
80
- };
81
- });
69
+ controller.abort()
70
+ }
71
+ })
82
72
 
83
73
  beforeNavigate((navigation) => {
84
74
  // Prefix links with the preview route parameter if the current
@@ -92,19 +82,14 @@
92
82
  // event, don't prefix the route. The exception is only
93
83
  // valid for one call.
94
84
  if (endingPreview) {
95
- endingPreview = false;
96
- return;
85
+ endingPreview = false
86
+ return
97
87
  }
98
88
 
99
- navigation.cancel();
100
- goto(
101
- new URL(
102
- routePrefix + navigation.to.url.pathname,
103
- navigation.to.url.origin,
104
- ),
105
- );
89
+ navigation.cancel()
90
+ goto(new URL(routePrefix + navigation.to.url.pathname, navigation.to.url.origin))
106
91
  }
107
- });
92
+ })
108
93
  </script>
109
94
 
110
95
  <svelte:head>
@@ -1,19 +1,15 @@
1
1
  type Props = {
2
2
  /**
3
- * The name of your Prismic repository. A Prismic Toolbar will be registered
4
- * using this repository.
3
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
4
+ * repository.
5
5
  */
6
6
  repositoryName: string;
7
- /**
8
- * The route parameter prefixed during preview sessions.
9
- */
7
+ /** The route parameter prefixed during preview sessions. */
10
8
  routePrefix?: string;
11
9
  /**
12
- * The name of the preview-specific route parameter prefixed during preview
13
- * sessions.
10
+ * The name of the preview-specific route parameter prefixed during preview sessions.
14
11
  *
15
- * Only set this value if the route parameter's name differs from the
16
- * parameter's value.
12
+ * Only set this value if the route parameter's name differs from the parameter's value.
17
13
  */
18
14
  routePrefixName?: string;
19
15
  };
@@ -1,22 +1,17 @@
1
1
  import * as prismic from "@prismicio/client";
2
2
  import type { Cookies } from "@sveltejs/kit";
3
- /**
4
- * Configuration for `enableAutoPreviews`.
5
- */
3
+ /** Configuration for `enableAutoPreviews`. */
6
4
  export type EnableAutoPreviewsConfig = {
7
- /**
8
- * Prismic client with which automatic previews will be enabled.
9
- */
5
+ /** Prismic client with which automatic previews will be enabled. */
10
6
  client: Pick<prismic.Client, "queryContentFromRef">;
11
7
  /**
12
- * The `cookies` object provided to a route's `load()` function. This
13
- * parameter is required to load previews.
8
+ * The `cookies` object provided to a route's `load()` function. This parameter is required to
9
+ * load previews.
14
10
  */
15
11
  cookies?: Cookies;
16
12
  };
17
13
  /**
18
- * Configures a Prismic client to automatically query draft content during a
19
- * preview session.
14
+ * Configures a Prismic client to automatically query draft content during a preview session.
20
15
  *
21
16
  * @param config - Configuration for the function.
22
17
  */
@@ -1,7 +1,6 @@
1
1
  import * as prismic from "@prismicio/client";
2
2
  /**
3
- * Configures a Prismic client to automatically query draft content during a
4
- * preview session.
3
+ * Configures a Prismic client to automatically query draft content during a preview session.
5
4
  *
6
5
  * @param config - Configuration for the function.
7
6
  */
@@ -1,9 +1,7 @@
1
1
  import * as prismic from "@prismicio/client";
2
2
  import type { Cookies } from "@sveltejs/kit";
3
3
  export type RedirectToPreviewURLConfig = {
4
- /**
5
- * The Prismic client configured for the preview session's repository.
6
- */
4
+ /** The Prismic client configured for the preview session's repository. */
7
5
  client: Pick<prismic.Client, "resolvePreviewURL">;
8
6
  /**
9
7
  * The `request` object from a `+server` file.
@@ -17,33 +15,27 @@ export type RedirectToPreviewURLConfig = {
17
15
  * @see SvelteKit `+server` docs: \<https://kit.svelte.dev/docs/routing#server\>
18
16
  */
19
17
  cookies: Cookies;
20
- /**
21
- * The default redirect URL if a URL cannot be determined for the previewed
22
- * document.
23
- */
18
+ /** The default redirect URL if a URL cannot be determined for the previewed document. */
24
19
  defaultURL?: string;
25
- /**
26
- * The route parameter prefixed during preview sessions.
27
- */
20
+ /** The route parameter prefixed during preview sessions. */
28
21
  routePrefix?: string;
29
22
  };
30
23
  /**
31
- * Redirects a visitor to the URL of a previewed Prismic document from within a
32
- * SvelteKit `+server` file.
24
+ * Redirects a visitor to the URL of a previewed Prismic document from within a SvelteKit `+server`
25
+ * file.
33
26
  *
34
27
  * Return the created `Response` in your `+server` file.
35
28
  *
36
29
  * @example
30
+ * ```typescript
31
+ * import { createClient } from "$lib/prismicio.js"
32
+ * import { redirectToPreviewURL } from "@prismicio/svelte/kit"
37
33
  *
38
- * ```typescript
39
- * import { createClient } from "../lib/prismicio.js";
40
- * import { redirectToPreviewURL } from "@prismicio/svelte/kit";
41
- *
42
- * export async function GET({ fetch, request }) {
43
- * const client = createClient({ fetch });
34
+ * export async function GET({ fetch, request }) {
35
+ * const client = createClient({ fetch })
44
36
  *
45
- * return await redirectToPreviewURL({ client, request });
46
- * }
47
- * ```
37
+ * return await redirectToPreviewURL({ client, request })
38
+ * }
39
+ * ```
48
40
  */
49
41
  export declare const redirectToPreviewURL: (config: RedirectToPreviewURLConfig) => Promise<Response>;