@prismicio/svelte 3.0.0-pr.71.c286545 → 3.0.0-pr.71.f7751fa
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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { beforeNavigate, goto, refreshAll } from "$app/navigation"
|
|
3
|
-
import { resolve } from "$app/paths"
|
|
4
|
-
import { page } from "$app/state"
|
|
5
3
|
import { getToolbarSrc } from "@prismicio/client"
|
|
6
4
|
import { onMount } from "svelte"
|
|
7
5
|
|
|
@@ -21,26 +19,11 @@
|
|
|
21
19
|
* Only set this value if the route parameter's name differs from the parameter's value.
|
|
22
20
|
*/
|
|
23
21
|
routePrefixName?: string
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The path of your preview route, without `paths.base`. The Prismic Toolbar uses it to create
|
|
27
|
-
* share links.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue `"/api/preview"`
|
|
30
|
-
*/
|
|
31
|
-
previewURL?: string
|
|
32
22
|
}
|
|
33
23
|
|
|
34
|
-
const {
|
|
35
|
-
repositoryName,
|
|
36
|
-
routePrefix = "preview",
|
|
37
|
-
routePrefixName = routePrefix,
|
|
38
|
-
previewURL = "/api/preview",
|
|
39
|
-
}: Props = $props()
|
|
24
|
+
const { repositoryName, routePrefix = "preview", routePrefixName = routePrefix }: Props = $props()
|
|
40
25
|
|
|
41
26
|
const toolbarSrc = $derived(getToolbarSrc(repositoryName, { version: 5 }))
|
|
42
|
-
// `resolve()` can return a path relative to the current page, which changes on navigation.
|
|
43
|
-
const previewPath = $derived(new URL(resolve(previewURL, {}), page.url).pathname)
|
|
44
27
|
|
|
45
28
|
/** Set to `true` when the next `beforeNavigate()` call should not prefix the route. */
|
|
46
29
|
let endingPreview = $state(false)
|
|
@@ -106,5 +89,5 @@
|
|
|
106
89
|
</script>
|
|
107
90
|
|
|
108
91
|
<svelte:head>
|
|
109
|
-
<script defer src={toolbarSrc}
|
|
92
|
+
<script defer src={toolbarSrc}></script>
|
|
110
93
|
</svelte:head>
|
|
@@ -12,13 +12,6 @@ type Props = {
|
|
|
12
12
|
* Only set this value if the route parameter's name differs from the parameter's value.
|
|
13
13
|
*/
|
|
14
14
|
routePrefixName?: string;
|
|
15
|
-
/**
|
|
16
|
-
* The path of your preview route, without `paths.base`. The Prismic Toolbar uses it to create
|
|
17
|
-
* share links.
|
|
18
|
-
*
|
|
19
|
-
* @defaultValue `"/api/preview"`
|
|
20
|
-
*/
|
|
21
|
-
previewURL?: string;
|
|
22
15
|
};
|
|
23
16
|
declare const PrismicPreview: import("svelte").Component<Props, {}, "">;
|
|
24
17
|
type PrismicPreview = ReturnType<typeof PrismicPreview>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { beforeNavigate, goto, refreshAll } from "$app/navigation"
|
|
3
|
-
import { resolve } from "$app/paths"
|
|
4
|
-
import { page } from "$app/state"
|
|
5
3
|
import { getToolbarSrc } from "@prismicio/client"
|
|
6
4
|
import { onMount } from "svelte"
|
|
7
5
|
|
|
@@ -21,26 +19,11 @@
|
|
|
21
19
|
* Only set this value if the route parameter's name differs from the parameter's value.
|
|
22
20
|
*/
|
|
23
21
|
routePrefixName?: string
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* The path of your preview route, without `paths.base`. The Prismic Toolbar uses it to create
|
|
27
|
-
* share links.
|
|
28
|
-
*
|
|
29
|
-
* @defaultValue `"/api/preview"`
|
|
30
|
-
*/
|
|
31
|
-
previewURL?: string
|
|
32
22
|
}
|
|
33
23
|
|
|
34
|
-
const {
|
|
35
|
-
repositoryName,
|
|
36
|
-
routePrefix = "preview",
|
|
37
|
-
routePrefixName = routePrefix,
|
|
38
|
-
previewURL = "/api/preview",
|
|
39
|
-
}: Props = $props()
|
|
24
|
+
const { repositoryName, routePrefix = "preview", routePrefixName = routePrefix }: Props = $props()
|
|
40
25
|
|
|
41
26
|
const toolbarSrc = $derived(getToolbarSrc(repositoryName, { version: 5 }))
|
|
42
|
-
// `resolve()` can return a path relative to the current page, which changes on navigation.
|
|
43
|
-
const previewPath = $derived(new URL(resolve(previewURL, {}), page.url).pathname)
|
|
44
27
|
|
|
45
28
|
/** Set to `true` when the next `beforeNavigate()` call should not prefix the route. */
|
|
46
29
|
let endingPreview = $state(false)
|
|
@@ -106,5 +89,5 @@
|
|
|
106
89
|
</script>
|
|
107
90
|
|
|
108
91
|
<svelte:head>
|
|
109
|
-
<script defer src={toolbarSrc}
|
|
92
|
+
<script defer src={toolbarSrc}></script>
|
|
110
93
|
</svelte:head>
|