@slicemachine/adapter-sveltekit 0.3.78-alpha.dependabot-npm-and-yarn-nuxt-3-16-0.1 → 0.3.78-alpha.lh-svelte5.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.
@@ -0,0 +1,124 @@
1
+ <script>
2
+ import { isFilled } from "@prismicio/client";
3
+ import {
4
+ PrismicImage,
5
+ PrismicRichText,
6
+ PrismicLink,
7
+ } from "@prismicio/svelte";
8
+
9
+ /**
10
+ * @type {{ slice: import("@prismicio/client").Content.${PascalNameToReplace}Slice }}
11
+ */
12
+ let { slice } = $props();
13
+ </script>
14
+
15
+ <section
16
+ data-slice-type={slice.slice_type}
17
+ data-slice-variation={slice.variation}
18
+ class="es-bounded es-customer-logos"
19
+ >
20
+ <div class="es-bounded__content es-customer-logos__content">
21
+ {#if isFilled.richText(slice.primary.eyebrowHeadline)}
22
+ <div class="es-customer-logos__heading">
23
+ <PrismicRichText field={slice.primary.eyebrowHeadline} />
24
+ </div>
25
+ {/if}
26
+ {#if slice.primary.logos.length > 0}
27
+ <ul class="es-customer-logos__logos">
28
+ {#each slice.primary.logos as logo}
29
+ {#if isFilled.image(logo.image)}
30
+ <li class="es-customer-logos__logo">
31
+ <PrismicLink field={logo.link}>
32
+ <PrismicImage
33
+ field={logo.image}
34
+ class="es-customer-logos__logo__link__image"
35
+ height="26"
36
+ width="160"
37
+ />
38
+ </PrismicLink>
39
+ </li>
40
+ {/if}
41
+ {/each}
42
+ </ul>
43
+ {/if}
44
+ <PrismicLink
45
+ field={slice.primary.callToActionLink}
46
+ class="es-customer-logos__button"
47
+ />
48
+ </div>
49
+
50
+ <style>
51
+ .es-bounded {
52
+ margin: 0px;
53
+ min-width: 0px;
54
+ position: relative;
55
+ padding: 8vw 1.25rem;
56
+ }
57
+
58
+ .es-bounded__content {
59
+ min-width: 0px;
60
+ max-width: 90%;
61
+ margin: 0px auto;
62
+ }
63
+
64
+ .es-customer-logos {
65
+ font-family: system-ui, sans-serif;
66
+ background-color: #f4f0ec;
67
+ color: #333;
68
+ }
69
+
70
+ .es-customer-logos__content {
71
+ display: grid;
72
+ gap: 2rem;
73
+ justify-items: center;
74
+ }
75
+
76
+ .es-customer-logos__heading {
77
+ color: #8592e0;
78
+ font-size: 1.5rem;
79
+ font-weight: 500;
80
+ text-align: center;
81
+ }
82
+
83
+ .es-customer-logos__heading * {
84
+ margin: 0;
85
+ }
86
+
87
+ .es-customer-logos__logos {
88
+ display: grid;
89
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
90
+ grid-column-gap: 1.25rem;
91
+ grid-row-gap: 2rem;
92
+ align-items: center;
93
+ list-style-type: none;
94
+ width: 100%;
95
+ }
96
+
97
+ @media (min-width: 1200px) {
98
+ .es-customer-logos__logos {
99
+ margin-left: -3rem;
100
+ }
101
+ }
102
+
103
+ .es-customer-logos__logo {
104
+ margin: 0;
105
+ display: flex;
106
+ justify-content: center;
107
+ }
108
+
109
+ @media (min-width: 1200px) {
110
+ .es-customer-logos__logo {
111
+ margin-left: 3rem;
112
+ }
113
+ }
114
+
115
+ .es-customer-logos__logo__link__image {
116
+ max-width: 10rem;
117
+ }
118
+
119
+ .es-customer-logos__button {
120
+ justify-self: center;
121
+ text-decoration: underline;
122
+ }
123
+ </style>
124
+ </section>
@@ -0,0 +1,125 @@
1
+ <script lang="ts">
2
+ import { type Content, isFilled } from "@prismicio/client";
3
+ import {
4
+ PrismicImage,
5
+ PrismicRichText,
6
+ PrismicLink,
7
+ } from "@prismicio/svelte";
8
+
9
+ interface Props {
10
+ slice: Content.PascalNameToReplaceSlice;
11
+ }
12
+
13
+ let { slice }: Props = $props();
14
+ </script>
15
+
16
+ <section
17
+ data-slice-type={slice.slice_type}
18
+ data-slice-variation={slice.variation}
19
+ class="es-bounded es-customer-logos"
20
+ >
21
+ <div class="es-bounded__content es-customer-logos__content">
22
+ {#if isFilled.richText(slice.primary.eyebrowHeadline)}
23
+ <div class="es-customer-logos__heading">
24
+ <PrismicRichText field={slice.primary.eyebrowHeadline} />
25
+ </div>
26
+ {/if}
27
+ {#if slice.primary.logos.length > 0}
28
+ <ul class="es-customer-logos__logos">
29
+ {#each slice.primary.logos as logo}
30
+ {#if isFilled.image(logo.image)}
31
+ <li class="es-customer-logos__logo">
32
+ <PrismicLink field={logo.link}>
33
+ <PrismicImage
34
+ field={logo.image}
35
+ class="es-customer-logos__logo__link__image"
36
+ height="26"
37
+ width="160"
38
+ />
39
+ </PrismicLink>
40
+ </li>
41
+ {/if}
42
+ {/each}
43
+ </ul>
44
+ {/if}
45
+ <PrismicLink
46
+ field={slice.primary.callToActionLink}
47
+ class="es-customer-logos__button"
48
+ />
49
+ </div>
50
+
51
+ <style>
52
+ .es-bounded {
53
+ margin: 0px;
54
+ min-width: 0px;
55
+ position: relative;
56
+ padding: 8vw 1.25rem;
57
+ }
58
+
59
+ .es-bounded__content {
60
+ min-width: 0px;
61
+ max-width: 90%;
62
+ margin: 0px auto;
63
+ }
64
+
65
+ .es-customer-logos {
66
+ font-family: system-ui, sans-serif;
67
+ background-color: #f4f0ec;
68
+ color: #333;
69
+ }
70
+
71
+ .es-customer-logos__content {
72
+ display: grid;
73
+ gap: 2rem;
74
+ justify-items: center;
75
+ }
76
+
77
+ .es-customer-logos__heading {
78
+ color: #8592e0;
79
+ font-size: 1.5rem;
80
+ font-weight: 500;
81
+ text-align: center;
82
+ }
83
+
84
+ .es-customer-logos__heading * {
85
+ margin: 0;
86
+ }
87
+
88
+ .es-customer-logos__logos {
89
+ display: grid;
90
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
91
+ grid-column-gap: 1.25rem;
92
+ grid-row-gap: 2rem;
93
+ align-items: center;
94
+ list-style-type: none;
95
+ width: 100%;
96
+ }
97
+
98
+ @media (min-width: 1200px) {
99
+ .es-customer-logos__logos {
100
+ margin-left: -3rem;
101
+ }
102
+ }
103
+
104
+ .es-customer-logos__logo {
105
+ margin: 0;
106
+ display: flex;
107
+ justify-content: center;
108
+ }
109
+
110
+ @media (min-width: 1200px) {
111
+ .es-customer-logos__logo {
112
+ margin-left: 3rem;
113
+ }
114
+ }
115
+
116
+ .es-customer-logos__logo__link__image {
117
+ max-width: 10rem;
118
+ }
119
+
120
+ .es-customer-logos__button {
121
+ justify-self: center;
122
+ text-decoration: underline;
123
+ }
124
+ </style>
125
+ </section>
@@ -0,0 +1,190 @@
1
+ <script>
2
+ import {
3
+ PrismicImage,
4
+ PrismicRichText,
5
+ PrismicLink,
6
+ } from "@prismicio/svelte";
7
+ import { isFilled } from "@prismicio/client";
8
+
9
+ /**
10
+ * @type {{ slice: import("@prismicio/client").Content.${PascalNameToReplace}Slice }}
11
+ */
12
+ let { slice } = $props();
13
+ </script>
14
+
15
+ <section
16
+ data-slice-type={slice.slice_type}
17
+ data-slice-variation={slice.variation}
18
+ class="es-bounded es-fullpage-hero"
19
+ >
20
+ <div
21
+ class={`
22
+ es-fullpage-hero__content
23
+ ${
24
+ slice.variation === "imageRight"
25
+ ? "es-fullpage-hero__image--right"
26
+ : "es-fullpage-hero__image--left"
27
+ }
28
+ `}
29
+ >
30
+ <div>
31
+ {#if isFilled.image(slice.primary.image)}
32
+ <PrismicImage
33
+ field={slice.primary.image}
34
+ class="es-fullpage-hero__image"
35
+ />
36
+ {/if}
37
+ </div>
38
+ <div class="es-fullpage-hero__content-right">
39
+ <div class="es-fullpage-hero__content__intro">
40
+ {#if isFilled.keyText(slice.primary.eyebrowHeadline)}
41
+ <p class="es-fullpage-hero__content__intro__eyebrow">
42
+ {slice.primary.eyebrowHeadline}
43
+ </p>
44
+ {/if}
45
+ {#if isFilled.richText(slice.primary.title)}
46
+ <div class="es-fullpage-hero__content__intro__headline">
47
+ <PrismicRichText field={slice.primary.title} />
48
+ </div>
49
+ {/if}
50
+ {#if isFilled.richText(slice.primary.description)}
51
+ <div class="es-fullpage-hero__content__intro__description">
52
+ <PrismicRichText field={slice.primary.description} />
53
+ </div>
54
+ {/if}
55
+ <PrismicLink
56
+ field={slice.primary.callToActionLink}
57
+ class="es-call-to-action__link"
58
+ />
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <style>
64
+ .es-bounded {
65
+ margin: 0px;
66
+ min-width: 0px;
67
+ position: relative;
68
+ }
69
+
70
+ .es-fullpage-hero {
71
+ font-family: system-ui, sans-serif;
72
+ background-color: #fff;
73
+ color: #333;
74
+ }
75
+
76
+ .es-fullpage-hero__image {
77
+ max-width: 100%;
78
+ height: auto;
79
+ align-self: center;
80
+ }
81
+
82
+ .es-fullpage-hero__image--left > div:first-child {
83
+ order: 1;
84
+ }
85
+
86
+ .es-fullpage-hero__image--left > div:nth-child(2) {
87
+ order: 2;
88
+ }
89
+
90
+ .es-fullpage-hero__image--right > div:first-child {
91
+ order: 2;
92
+ }
93
+
94
+ .es-fullpage-hero__image--right > div:nth-child(2) {
95
+ order: 1;
96
+ }
97
+
98
+ .es-fullpage-hero__content {
99
+ display: flex;
100
+ flex-direction: column;
101
+ gap: 2rem;
102
+ }
103
+
104
+ .es-fullpage-hero__content-right {
105
+ display: flex;
106
+ flex-direction: column;
107
+ justify-content: space-around;
108
+ padding: 1.5rem;
109
+ }
110
+
111
+ @media (min-width: 1080px) {
112
+ .es-fullpage-hero__content {
113
+ flex-direction: row;
114
+ }
115
+
116
+ .es-fullpage-hero__content > div {
117
+ width: 50%;
118
+ }
119
+ }
120
+
121
+ .es-fullpage-hero__content__intro {
122
+ display: grid;
123
+ gap: 1rem;
124
+ }
125
+
126
+ .es-fullpage-hero__content__intro__eyebrow {
127
+ color: #47c1af;
128
+ font-size: 1.15rem;
129
+ font-weight: 500;
130
+ margin: 0;
131
+ }
132
+
133
+ .es-fullpage-hero__content__intro__headline {
134
+ font-size: 1.625rem;
135
+ font-weight: 700;
136
+ }
137
+
138
+ .es-fullpage-hero__content__intro__headline * {
139
+ margin: 0;
140
+ }
141
+
142
+ @media (min-width: 640px) {
143
+ .es-fullpage-hero__content__intro__headline {
144
+ font-size: 2rem;
145
+ }
146
+ }
147
+
148
+ @media (min-width: 1024px) {
149
+ .es-fullpage-hero__content__intro__headline {
150
+ font-size: 2.5rem;
151
+ }
152
+ }
153
+
154
+ @media (min-width: 1200px) {
155
+ .es-fullpage-hero__content__intro__headline {
156
+ font-size: 2.75rem;
157
+ }
158
+ }
159
+
160
+ .es-fullpage-hero__content__intro__description {
161
+ font-size: 1.15rem;
162
+ max-width: 38rem;
163
+ }
164
+
165
+ .es-fullpage-hero__content__intro__description > p {
166
+ margin: 0;
167
+ }
168
+
169
+ @media (min-width: 1200px) {
170
+ .es-fullpage-hero__content__intro__description {
171
+ font-size: 1.4rem;
172
+ }
173
+ }
174
+
175
+ .es-call-to-action__link {
176
+ justify-self: flex-start;
177
+ border-radius: 0.25rem;
178
+ font-size: 0.875rem;
179
+ line-height: 1.3;
180
+ padding: 1rem 2.625rem;
181
+ transition: background-color 100ms linear;
182
+ background-color: #16745f;
183
+ color: #fff;
184
+ }
185
+
186
+ .es-call-to-action__link:hover {
187
+ background-color: #0d5e4c;
188
+ }
189
+ </style>
190
+ </section>
@@ -0,0 +1,191 @@
1
+ <script lang="ts">
2
+ import {
3
+ PrismicImage,
4
+ PrismicRichText,
5
+ PrismicLink,
6
+ } from "@prismicio/svelte";
7
+ import { type Content, isFilled } from "@prismicio/client";
8
+
9
+ interface Props {
10
+ slice: Content.PascalNameToReplaceSlice;
11
+ }
12
+
13
+ let { slice }: Props = $props();
14
+ </script>
15
+
16
+ <section
17
+ data-slice-type={slice.slice_type}
18
+ data-slice-variation={slice.variation}
19
+ class="es-bounded es-fullpage-hero"
20
+ >
21
+ <div
22
+ class={`
23
+ es-fullpage-hero__content
24
+ ${
25
+ slice.variation === "imageRight"
26
+ ? "es-fullpage-hero__image--right"
27
+ : "es-fullpage-hero__image--left"
28
+ }
29
+ `}
30
+ >
31
+ <div>
32
+ {#if isFilled.image(slice.primary.image)}
33
+ <PrismicImage
34
+ field={slice.primary.image}
35
+ class="es-fullpage-hero__image"
36
+ />
37
+ {/if}
38
+ </div>
39
+ <div class="es-fullpage-hero__content-right">
40
+ <div class="es-fullpage-hero__content__intro">
41
+ {#if isFilled.keyText(slice.primary.eyebrowHeadline)}
42
+ <p class="es-fullpage-hero__content__intro__eyebrow">
43
+ {slice.primary.eyebrowHeadline}
44
+ </p>
45
+ {/if}
46
+ {#if isFilled.richText(slice.primary.title)}
47
+ <div class="es-fullpage-hero__content__intro__headline">
48
+ <PrismicRichText field={slice.primary.title} />
49
+ </div>
50
+ {/if}
51
+ {#if isFilled.richText(slice.primary.description)}
52
+ <div class="es-fullpage-hero__content__intro__description">
53
+ <PrismicRichText field={slice.primary.description} />
54
+ </div>
55
+ {/if}
56
+ <PrismicLink
57
+ field={slice.primary.callToActionLink}
58
+ class="es-call-to-action__link"
59
+ />
60
+ </div>
61
+ </div>
62
+ </div>
63
+
64
+ <style>
65
+ .es-bounded {
66
+ margin: 0px;
67
+ min-width: 0px;
68
+ position: relative;
69
+ }
70
+
71
+ .es-fullpage-hero {
72
+ font-family: system-ui, sans-serif;
73
+ background-color: #fff;
74
+ color: #333;
75
+ }
76
+
77
+ .es-fullpage-hero__image {
78
+ max-width: 100%;
79
+ height: auto;
80
+ align-self: center;
81
+ }
82
+
83
+ .es-fullpage-hero__image--left > div:first-child {
84
+ order: 1;
85
+ }
86
+
87
+ .es-fullpage-hero__image--left > div:nth-child(2) {
88
+ order: 2;
89
+ }
90
+
91
+ .es-fullpage-hero__image--right > div:first-child {
92
+ order: 2;
93
+ }
94
+
95
+ .es-fullpage-hero__image--right > div:nth-child(2) {
96
+ order: 1;
97
+ }
98
+
99
+ .es-fullpage-hero__content {
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: 2rem;
103
+ }
104
+
105
+ .es-fullpage-hero__content-right {
106
+ display: flex;
107
+ flex-direction: column;
108
+ justify-content: space-around;
109
+ padding: 1.5rem;
110
+ }
111
+
112
+ @media (min-width: 1080px) {
113
+ .es-fullpage-hero__content {
114
+ flex-direction: row;
115
+ }
116
+
117
+ .es-fullpage-hero__content > div {
118
+ width: 50%;
119
+ }
120
+ }
121
+
122
+ .es-fullpage-hero__content__intro {
123
+ display: grid;
124
+ gap: 1rem;
125
+ }
126
+
127
+ .es-fullpage-hero__content__intro__eyebrow {
128
+ color: #47c1af;
129
+ font-size: 1.15rem;
130
+ font-weight: 500;
131
+ margin: 0;
132
+ }
133
+
134
+ .es-fullpage-hero__content__intro__headline {
135
+ font-size: 1.625rem;
136
+ font-weight: 700;
137
+ }
138
+
139
+ .es-fullpage-hero__content__intro__headline * {
140
+ margin: 0;
141
+ }
142
+
143
+ @media (min-width: 640px) {
144
+ .es-fullpage-hero__content__intro__headline {
145
+ font-size: 2rem;
146
+ }
147
+ }
148
+
149
+ @media (min-width: 1024px) {
150
+ .es-fullpage-hero__content__intro__headline {
151
+ font-size: 2.5rem;
152
+ }
153
+ }
154
+
155
+ @media (min-width: 1200px) {
156
+ .es-fullpage-hero__content__intro__headline {
157
+ font-size: 2.75rem;
158
+ }
159
+ }
160
+
161
+ .es-fullpage-hero__content__intro__description {
162
+ font-size: 1.15rem;
163
+ max-width: 38rem;
164
+ }
165
+
166
+ .es-fullpage-hero__content__intro__description > p {
167
+ margin: 0;
168
+ }
169
+
170
+ @media (min-width: 1200px) {
171
+ .es-fullpage-hero__content__intro__description {
172
+ font-size: 1.4rem;
173
+ }
174
+ }
175
+
176
+ .es-call-to-action__link {
177
+ justify-self: flex-start;
178
+ border-radius: 0.25rem;
179
+ font-size: 0.875rem;
180
+ line-height: 1.3;
181
+ padding: 1rem 2.625rem;
182
+ transition: background-color 100ms linear;
183
+ background-color: #16745f;
184
+ color: #fff;
185
+ }
186
+
187
+ .es-call-to-action__link:hover {
188
+ background-color: #0d5e4c;
189
+ }
190
+ </style>
191
+ </section>
@@ -2,10 +2,11 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const commonTags = require("common-tags");
4
4
  const getJSFileExtension = require("../lib/getJSFileExtension.cjs");
5
+ const checkIsSvelte5 = require("../lib/checkIsSvelte5.cjs");
5
6
  var __freeze = Object.freeze;
6
7
  var __defProp = Object.defineProperty;
7
8
  var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
8
- var _a;
9
+ var _a, _b;
9
10
  const nestRouteFilePath = (filePath, nesting) => {
10
11
  return [
11
12
  ...filePath.split("/").slice(0, 2),
@@ -17,6 +18,7 @@ const documentationRead = async (data, { options, helpers }) => {
17
18
  if (data.kind === "PageSnippet") {
18
19
  const { model } = data.data;
19
20
  const pageDataExtension = await getJSFileExtension.getJSFileExtension({ helpers, options });
21
+ const isSvelte5 = await checkIsSvelte5.checkIsSvelte5({ helpers });
20
22
  const routePath = `src/routes/${model.repeatable ? "[uid]" : model.id}`;
21
23
  const dataFilePath = `${routePath}/+page.server.${pageDataExtension}`;
22
24
  const componentFilePath = `${routePath}/+page.svelte`;
@@ -64,7 +66,12 @@ const documentationRead = async (data, { options, helpers }) => {
64
66
  }
65
67
  `;
66
68
  }
67
- let componentFileContent = commonTags.source(_a || (_a = __template(['\n <script>\n import { SliceZone } from "@prismicio/svelte";\n\n import { components } from "$lib/slices";\n\n export let data;\n <\/script>\n\n <SliceZone slices={data.page.data.slices} {components} />\n '])));
69
+ let componentFileContent;
70
+ if (isSvelte5) {
71
+ componentFileContent = commonTags.source(_a || (_a = __template(['\n <script>\n import { SliceZone } from "@prismicio/svelte";\n\n import { components } from "$lib/slices";\n\n let { data } = $props();\n <\/script>\n\n <SliceZone slices={data.page.data.slices} components={components} />\n '])));
72
+ } else {
73
+ componentFileContent = commonTags.source(_b || (_b = __template(['\n <script>\n import { SliceZone } from "@prismicio/svelte";\n\n import { components } from "$lib/slices";\n\n export let data;\n <\/script>\n\n <SliceZone slices={data.page.data.slices} {components} />\n '])));
74
+ }
68
75
  if (options.format) {
69
76
  dataFileContent = await helpers.format(dataFileContent, helpers.joinPathFromRoot(dataFilePath), {
70
77
  includeNewlineAtEnd: false
@@ -1 +1 @@
1
- {"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst nestRouteFilePath = (filePath: string, nesting: string): string => {\n\treturn [\n\t\t...filePath.split(\"/\").slice(0, 2),\n\t\tnesting,\n\t\t...filePath.split(\"/\").slice(2),\n\t].join(\"/\");\n};\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\n\t\tconst pageDataExtension = await getJSFileExtension({ helpers, options });\n\n\t\tconst routePath = `src/routes/${model.repeatable ? \"[uid]\" : model.id}`;\n\t\tconst dataFilePath = `${routePath}/+page.server.${pageDataExtension}`;\n\t\tconst componentFilePath = `${routePath}/+page.svelte`;\n\n\t\tlet dataFileContent: string;\n\t\tif (model.repeatable) {\n\t\t\tdataFileContent = source`\n\t\t\t\timport { createClient } from \"$lib/prismicio\";\n\n\t\t\t\texport async function load({ params, fetch, cookies }) {\n\t\t\t\t\tconst client = createClient({ fetch, cookies });\n\n\t\t\t\t\tconst page = await client.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpage,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\texport async function entries() {\n\t\t\t\t\tconst client = createClient();\n\n\t\t\t\t\tconst pages = await client.getAllByType(\"${model.id}\");\n\n\t\t\t\t\treturn pages.map((page) => {\n\t\t\t\t\t\treturn { uid: page.uid };\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t`;\n\t\t} else {\n\t\t\tdataFileContent = source`\n\t\t\t\timport { createClient } from \"$lib/prismicio\";\n\n\t\t\t\texport async function load({ params, fetch, cookies }) {\n\t\t\t\t\tconst client = createClient({ fetch, cookies });\n\n\t\t\t\t\tconst page = await client.getSingle(\"${model.id}\");\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpage,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\texport async function entries() {\n\t\t\t\t\treturn [{}]\n\t\t\t\t}\n\t\t\t`;\n\t\t}\n\n\t\tlet componentFileContent = source`\n\t\t\t<script>\n\t\t\t\timport { SliceZone } from \"@prismicio/svelte\";\n\n\t\t\t\timport { components } from \"$lib/slices\";\n\n\t\t\t\texport let data;\n\t\t\t</script>\n\n\t\t\t<SliceZone slices={data.page.data.slices} {components} />\n\t\t`;\n\n\t\tif (options.format) {\n\t\t\tdataFileContent = await helpers.format(\n\t\t\t\tdataFileContent,\n\t\t\t\thelpers.joinPathFromRoot(dataFilePath),\n\t\t\t\t{\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\tcomponentFileContent = await helpers.format(\n\t\t\t\tcomponentFileContent,\n\t\t\t\thelpers.joinPathFromRoot(componentFilePath),\n\t\t\t\t{\n\t\t\t\t\tprettier: {\n\t\t\t\t\t\tplugins: [\"prettier-plugin-svelte\"],\n\t\t\t\t\t\tparser: \"svelte\",\n\t\t\t\t\t},\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst nestedDataFilePath = nestRouteFilePath(dataFilePath, \"marketing\");\n\t\tconst nestedComponentFilePath = nestRouteFilePath(\n\t\t\tcomponentFilePath,\n\t\t\t\"marketing\",\n\t\t);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Default\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page data fetcher\n\n\t\t\t\t\tAdd a new route by creating a \\`${dataFilePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`${nestedDataFilePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~${pageDataExtension} [${dataFilePath}]\\n${dataFileContent}\\n~~~`}\n\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tIn the route's directory, create a \\`${componentFilePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`${nestedComponentFilePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~svelte [${componentFilePath}]\\n${componentFileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/svelte-install) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["getJSFileExtension","source"],"mappings":";;;;;;;AAAA,IAAA;AAQA,MAAM,oBAAoB,CAAC,UAAkB,YAA2B;AAChE,SAAA;AAAA,IACN,GAAG,SAAS,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC;AAAA,IACjC;AAAA,IACA,GAAG,SAAS,MAAM,GAAG,EAAE,MAAM,CAAC;AAAA,EAAA,EAC7B,KAAK,GAAG;AACX;AAEO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AAEvB,UAAM,oBAAoB,MAAMA,mBAAA,mBAAmB,EAAE,SAAS,QAAS,CAAA;AAEvE,UAAM,YAAY,cAAc,MAAM,aAAa,UAAU,MAAM;AAC7D,UAAA,eAAe,GAAG,0BAA0B;AAClD,UAAM,oBAAoB,GAAG;AAEzB,QAAA;AACJ,QAAI,MAAM,YAAY;AACH,wBAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,2CAMsB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gDAUD,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,OAO7C;AACY,wBAAAA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,4CAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWhD;AAEA,QAAI,uBAAuBA,WAAM,OAAA,OAAA,KAAA,WAAA,CAAA,+NAAA,CAAA,EAAA;AAYjC,QAAI,QAAQ,QAAQ;AACnB,wBAAkB,MAAM,QAAQ,OAC/B,iBACA,QAAQ,iBAAiB,YAAY,GACrC;AAAA,QACC,qBAAqB;AAAA,MAAA,CACrB;AAEF,6BAAuB,MAAM,QAAQ,OACpC,sBACA,QAAQ,iBAAiB,iBAAiB,GAC1C;AAAA,QACC,UAAU;AAAA,UACT,SAAS,CAAC,wBAAwB;AAAA,UAClC,QAAQ;AAAA,QACR;AAAA,QACD,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEM,UAAA,qBAAqB,kBAAkB,cAAc,WAAW;AAChE,UAAA,0BAA0B,kBAC/B,mBACA,WAAW;AAGL,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAASA,WAAAA;AAAAA,sBACS,MAAM;AAAA;AAAA,uCAEW,4HAA4H;AAAA;AAAA;AAAA;AAAA,OAI5J,MAAM,sBAAsB;AAAA,EAAkB;AAAA;AAAA;AAAA,sBAE/B,MAAM;AAAA;AAAA,4CAEgB,iIAAiI;AAAA;AAAA;AAAA;AAAA,OAItK,cAAc;AAAA,EAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,MAIxC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;;"}
1
+ {"version":3,"file":"documentation-read.cjs","sources":["../../../src/hooks/documentation-read.ts"],"sourcesContent":["import { source } from \"common-tags\";\n\nimport type { DocumentationReadHook } from \"@slicemachine/plugin-kit\";\n\nimport { getJSFileExtension } from \"../lib/getJSFileExtension\";\nimport { checkIsSvelte5 } from \"../lib/checkIsSvelte5\";\n\nimport type { PluginOptions } from \"../types\";\n\nconst nestRouteFilePath = (filePath: string, nesting: string): string => {\n\treturn [\n\t\t...filePath.split(\"/\").slice(0, 2),\n\t\tnesting,\n\t\t...filePath.split(\"/\").slice(2),\n\t].join(\"/\");\n};\n\nexport const documentationRead: DocumentationReadHook<PluginOptions> = async (\n\tdata,\n\t{ options, helpers },\n) => {\n\tif (data.kind === \"PageSnippet\") {\n\t\tconst { model } = data.data;\n\n\t\tconst pageDataExtension = await getJSFileExtension({ helpers, options });\n\t\tconst isSvelte5 = await checkIsSvelte5({ helpers });\n\n\t\tconst routePath = `src/routes/${model.repeatable ? \"[uid]\" : model.id}`;\n\t\tconst dataFilePath = `${routePath}/+page.server.${pageDataExtension}`;\n\t\tconst componentFilePath = `${routePath}/+page.svelte`;\n\n\t\tlet dataFileContent: string;\n\t\tif (model.repeatable) {\n\t\t\tdataFileContent = source`\n\t\t\t\timport { createClient } from \"$lib/prismicio\";\n\n\t\t\t\texport async function load({ params, fetch, cookies }) {\n\t\t\t\t\tconst client = createClient({ fetch, cookies });\n\n\t\t\t\t\tconst page = await client.getByUID(\"${model.id}\", params.uid);\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpage,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\texport async function entries() {\n\t\t\t\t\tconst client = createClient();\n\n\t\t\t\t\tconst pages = await client.getAllByType(\"${model.id}\");\n\n\t\t\t\t\treturn pages.map((page) => {\n\t\t\t\t\t\treturn { uid: page.uid };\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t`;\n\t\t} else {\n\t\t\tdataFileContent = source`\n\t\t\t\timport { createClient } from \"$lib/prismicio\";\n\n\t\t\t\texport async function load({ params, fetch, cookies }) {\n\t\t\t\t\tconst client = createClient({ fetch, cookies });\n\n\t\t\t\t\tconst page = await client.getSingle(\"${model.id}\");\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpage,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\texport async function entries() {\n\t\t\t\t\treturn [{}]\n\t\t\t\t}\n\t\t\t`;\n\t\t}\n\n\t\tlet componentFileContent;\n\n\t\tif (isSvelte5) {\n\t\t\t// Svelte 5 syntax with runes\n\t\t\tcomponentFileContent = source`\n\t\t\t\t<script>\n\t\t\t\t\timport { SliceZone } from \"@prismicio/svelte\";\n\n\t\t\t\t\timport { components } from \"$lib/slices\";\n\n\t\t\t\t\tlet { data } = $props();\n\t\t\t\t</script>\n\n\t\t\t\t<SliceZone slices={data.page.data.slices} components={components} />\n\t\t\t`;\n\t\t} else {\n\t\t\t// Traditional Svelte 3/4 syntax\n\t\t\tcomponentFileContent = source`\n\t\t\t\t<script>\n\t\t\t\t\timport { SliceZone } from \"@prismicio/svelte\";\n\n\t\t\t\t\timport { components } from \"$lib/slices\";\n\n\t\t\t\t\texport let data;\n\t\t\t\t</script>\n\n\t\t\t\t<SliceZone slices={data.page.data.slices} {components} />\n\t\t\t`;\n\t\t}\n\n\t\tif (options.format) {\n\t\t\tdataFileContent = await helpers.format(\n\t\t\t\tdataFileContent,\n\t\t\t\thelpers.joinPathFromRoot(dataFilePath),\n\t\t\t\t{\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\tcomponentFileContent = await helpers.format(\n\t\t\t\tcomponentFileContent,\n\t\t\t\thelpers.joinPathFromRoot(componentFilePath),\n\t\t\t\t{\n\t\t\t\t\tprettier: {\n\t\t\t\t\t\tplugins: [\"prettier-plugin-svelte\"],\n\t\t\t\t\t\tparser: \"svelte\",\n\t\t\t\t\t},\n\t\t\t\t\tincludeNewlineAtEnd: false,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\tconst nestedDataFilePath = nestRouteFilePath(dataFilePath, \"marketing\");\n\t\tconst nestedComponentFilePath = nestRouteFilePath(\n\t\t\tcomponentFilePath,\n\t\t\t\"marketing\",\n\t\t);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: \"Default\",\n\t\t\t\tcontent: source`\n\t\t\t\t\t## Create your ${model.label}'s page data fetcher\n\n\t\t\t\t\tAdd a new route by creating a \\`${dataFilePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`${nestedDataFilePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~${pageDataExtension} [${dataFilePath}]\\n${dataFileContent}\\n~~~`}\n\n\t\t\t\t\t## Create your ${model.label}'s page component\n\n\t\t\t\t\tIn the route's directory, create a \\`${componentFilePath}\\` file. (If the route should be nested in a child directory, you can create the file in a directory, like \\`${nestedComponentFilePath}\\`.)\n\n\t\t\t\t\tPaste in this code:\n\n\t\t\t\t\t${`~~~svelte [${componentFilePath}]\\n${componentFileContent}\\n~~~`}\n\n\t\t\t\t\tMake sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/svelte-install) for more information.\n\t\t\t\t`,\n\t\t\t},\n\t\t];\n\t}\n\n\treturn [];\n};\n"],"names":["getJSFileExtension","checkIsSvelte5","source"],"mappings":";;;;;;;;AAAA,IAAA,IAAA;AASA,MAAM,oBAAoB,CAAC,UAAkB,YAA2B;AAChE,SAAA;AAAA,IACN,GAAG,SAAS,MAAM,GAAG,EAAE,MAAM,GAAG,CAAC;AAAA,IACjC;AAAA,IACA,GAAG,SAAS,MAAM,GAAG,EAAE,MAAM,CAAC;AAAA,EAAA,EAC7B,KAAK,GAAG;AACX;AAEO,MAAM,oBAA0D,OACtE,MACA,EAAE,SAAS,cACR;AACC,MAAA,KAAK,SAAS,eAAe;AAC1B,UAAA,EAAE,MAAK,IAAK,KAAK;AAEvB,UAAM,oBAAoB,MAAMA,mBAAA,mBAAmB,EAAE,SAAS,QAAS,CAAA;AACvE,UAAM,YAAY,MAAMC,eAAAA,eAAe,EAAE,QAAS,CAAA;AAElD,UAAM,YAAY,cAAc,MAAM,aAAa,UAAU,MAAM;AAC7D,UAAA,eAAe,GAAG,0BAA0B;AAClD,UAAM,oBAAoB,GAAG;AAEzB,QAAA;AACJ,QAAI,MAAM,YAAY;AACH,wBAAAC,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,2CAMsB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gDAUD,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,OAO7C;AACY,wBAAAA,WAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA;AAAAA,4CAMuB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWhD;AAEI,QAAA;AAEJ,QAAI,WAAW;AAEd,6BAAuBA,WAAAA,OAAM,OAAA,KAAA,WAAA,CAAA,yPAAA,CAAA,EAAA;AAAA,IAAA,OAWvB;AAEN,6BAAuBA,WAAAA,OAAM,OAAA,KAAA,WAAA,CAAA,sOAAA,CAAA,EAAA;AAAA,IAW9B;AAEA,QAAI,QAAQ,QAAQ;AACnB,wBAAkB,MAAM,QAAQ,OAC/B,iBACA,QAAQ,iBAAiB,YAAY,GACrC;AAAA,QACC,qBAAqB;AAAA,MAAA,CACrB;AAEF,6BAAuB,MAAM,QAAQ,OACpC,sBACA,QAAQ,iBAAiB,iBAAiB,GAC1C;AAAA,QACC,UAAU;AAAA,UACT,SAAS,CAAC,wBAAwB;AAAA,UAClC,QAAQ;AAAA,QACR;AAAA,QACD,qBAAqB;AAAA,MAAA,CACrB;AAAA,IAEH;AAEM,UAAA,qBAAqB,kBAAkB,cAAc,WAAW;AAChE,UAAA,0BAA0B,kBAC/B,mBACA,WAAW;AAGL,WAAA;AAAA,MACN;AAAA,QACC,OAAO;AAAA,QACP,SAASA,WAAAA;AAAAA,sBACS,MAAM;AAAA;AAAA,uCAEW,4HAA4H;AAAA;AAAA;AAAA;AAAA,OAI5J,MAAM,sBAAsB;AAAA,EAAkB;AAAA;AAAA;AAAA,sBAE/B,MAAM;AAAA;AAAA,4CAEgB,iIAAiI;AAAA;AAAA;AAAA;AAAA,OAItK,cAAc;AAAA,EAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,MAIxC;AAAA,IAAA;AAAA,EAEH;AAEA,SAAO;AACR;;"}