@slicemachine/adapter-sveltekit 0.3.18-dev-next-release.2 → 0.3.18-dev-next-release.4

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,299 @@
1
+ const screenshotPaths = {
2
+ default: "Hero/screenshot-default.png",
3
+ imageRight: "Hero/screenshot-imageRight.png"
4
+ };
5
+ const mocks = [
6
+ {
7
+ __TYPE__: "SharedSliceContent",
8
+ variation: "default",
9
+ primary: {
10
+ title: {
11
+ __TYPE__: "StructuredTextContent",
12
+ value: [
13
+ {
14
+ type: "heading2",
15
+ content: {
16
+ text: "Build a website that keeps getting better",
17
+ spans: []
18
+ },
19
+ direction: "ltr"
20
+ }
21
+ ]
22
+ },
23
+ eyebrowHeadline: {
24
+ __TYPE__: "FieldContent",
25
+ type: "Text",
26
+ value: "Hero"
27
+ },
28
+ description: {
29
+ __TYPE__: "StructuredTextContent",
30
+ value: [
31
+ {
32
+ type: "paragraph",
33
+ content: {
34
+ text: "Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases",
35
+ spans: []
36
+ },
37
+ direction: "ltr"
38
+ }
39
+ ]
40
+ },
41
+ image: {
42
+ url: "https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85",
43
+ origin: {
44
+ id: "h5yMpgOI5nI",
45
+ url: "https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85",
46
+ width: 3710,
47
+ height: 3710
48
+ },
49
+ width: 3710,
50
+ height: 3710,
51
+ edit: {
52
+ background: "transparent",
53
+ zoom: 1,
54
+ crop: {
55
+ x: 0,
56
+ y: 0
57
+ }
58
+ },
59
+ credits: null,
60
+ alt: "Image Content",
61
+ __TYPE__: "ImageContent",
62
+ thumbnails: {}
63
+ },
64
+ callToActionLabel: {
65
+ __TYPE__: "FieldContent",
66
+ type: "Text",
67
+ value: "Call to Action"
68
+ },
69
+ callToActionLink: {
70
+ __TYPE__: "LinkContent",
71
+ value: {
72
+ __TYPE__: "ExternalLink",
73
+ url: "https://prismic.io",
74
+ target: ""
75
+ }
76
+ }
77
+ },
78
+ items: []
79
+ },
80
+ {
81
+ __TYPE__: "SharedSliceContent",
82
+ variation: "imageRight",
83
+ primary: {
84
+ eyebrowHeadline: {
85
+ __TYPE__: "FieldContent",
86
+ type: "Text",
87
+ value: "Image Right"
88
+ },
89
+ title: {
90
+ __TYPE__: "StructuredTextContent",
91
+ value: [
92
+ {
93
+ type: "heading1",
94
+ content: {
95
+ text: "Build a website",
96
+ spans: []
97
+ },
98
+ direction: "ltr"
99
+ }
100
+ ]
101
+ },
102
+ description: {
103
+ __TYPE__: "StructuredTextContent",
104
+ value: [
105
+ {
106
+ type: "paragraph",
107
+ content: {
108
+ text: "Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases, including Image Right slice variations!",
109
+ spans: []
110
+ },
111
+ direction: "ltr"
112
+ },
113
+ {
114
+ type: "paragraph",
115
+ content: {
116
+ text: "\nBy the way: this RichText field supports multi-paragraph!",
117
+ spans: []
118
+ },
119
+ direction: "ltr"
120
+ }
121
+ ]
122
+ },
123
+ image: {
124
+ origin: {
125
+ id: "euqiHwS38Rw",
126
+ url: "https://images.unsplash.com/photo-1595475207225-428b62bda831?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHwyMHx8ZnJ1aXR8ZW58MHx8fHwxNjk0NDQyOTc2fDA&ixlib=rb-4.0.3&q=85",
127
+ width: 2500,
128
+ height: 2500
129
+ },
130
+ url: "https://images.unsplash.com/photo-1595475207225-428b62bda831?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHwyMHx8ZnJ1aXR8ZW58MHx8fHwxNjk0NDQyOTc2fDA&ixlib=rb-4.0.3&q=85",
131
+ width: 2500,
132
+ height: 2500,
133
+ edit: {
134
+ background: "transparent",
135
+ zoom: 1,
136
+ crop: {
137
+ x: 0,
138
+ y: 0
139
+ }
140
+ },
141
+ credits: null,
142
+ alt: "Image Content",
143
+ __TYPE__: "ImageContent",
144
+ thumbnails: {}
145
+ },
146
+ callToActionLabel: {
147
+ __TYPE__: "FieldContent",
148
+ type: "Text",
149
+ value: "Call to Action"
150
+ },
151
+ callToActionLink: {
152
+ __TYPE__: "LinkContent",
153
+ value: {
154
+ __TYPE__: "ExternalLink",
155
+ url: "https://prismic.io",
156
+ target: ""
157
+ }
158
+ }
159
+ },
160
+ items: [
161
+ {
162
+ __TYPE__: "GroupItemContent",
163
+ value: []
164
+ }
165
+ ]
166
+ }
167
+ ];
168
+ const model = {
169
+ id: "hero",
170
+ type: "SharedSlice",
171
+ name: "Hero",
172
+ description: "Hero",
173
+ variations: [
174
+ {
175
+ id: "default",
176
+ name: "Default",
177
+ docURL: "...",
178
+ version: "initial",
179
+ description: "Default",
180
+ imageUrl: "",
181
+ primary: {
182
+ eyebrowHeadline: {
183
+ type: "Text",
184
+ config: {
185
+ label: "eyebrowHeadline",
186
+ placeholder: "Eyebrow"
187
+ }
188
+ },
189
+ title: {
190
+ type: "StructuredText",
191
+ config: {
192
+ label: "title",
193
+ placeholder: "",
194
+ allowTargetBlank: true,
195
+ single: "heading1,heading2,heading3,heading4,heading5,heading6,strong,em"
196
+ }
197
+ },
198
+ description: {
199
+ type: "StructuredText",
200
+ config: {
201
+ label: "description",
202
+ placeholder: "",
203
+ allowTargetBlank: true,
204
+ multi: "paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item"
205
+ }
206
+ },
207
+ image: {
208
+ type: "Image",
209
+ config: {
210
+ label: "image",
211
+ constraint: {},
212
+ thumbnails: []
213
+ }
214
+ },
215
+ callToActionLabel: {
216
+ type: "Text",
217
+ config: {
218
+ label: "callToActionLabel",
219
+ placeholder: ""
220
+ }
221
+ },
222
+ callToActionLink: {
223
+ type: "Link",
224
+ config: {
225
+ label: "callToActionLink",
226
+ placeholder: "",
227
+ select: null
228
+ }
229
+ }
230
+ },
231
+ items: {}
232
+ },
233
+ {
234
+ id: "imageRight",
235
+ name: "Image Right",
236
+ docURL: "...",
237
+ version: "initial",
238
+ description: "Default",
239
+ imageUrl: "",
240
+ primary: {
241
+ eyebrowHeadline: {
242
+ type: "Text",
243
+ config: {
244
+ label: "eyebrowHeadline",
245
+ placeholder: "Eyebrow"
246
+ }
247
+ },
248
+ title: {
249
+ type: "StructuredText",
250
+ config: {
251
+ label: "title",
252
+ placeholder: "",
253
+ allowTargetBlank: true,
254
+ single: "heading1,heading2,heading3,heading4,heading5,heading6,strong,em"
255
+ }
256
+ },
257
+ description: {
258
+ type: "StructuredText",
259
+ config: {
260
+ label: "description",
261
+ placeholder: "",
262
+ allowTargetBlank: true,
263
+ multi: "paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item"
264
+ }
265
+ },
266
+ image: {
267
+ type: "Image",
268
+ config: {
269
+ label: "image",
270
+ constraint: {},
271
+ thumbnails: []
272
+ }
273
+ },
274
+ callToActionLabel: {
275
+ type: "Text",
276
+ config: {
277
+ label: "callToActionLabel",
278
+ placeholder: ""
279
+ }
280
+ },
281
+ callToActionLink: {
282
+ type: "Link",
283
+ config: {
284
+ label: "callToActionLink",
285
+ placeholder: "",
286
+ select: null
287
+ }
288
+ }
289
+ },
290
+ items: {}
291
+ }
292
+ ]
293
+ };
294
+ export {
295
+ mocks,
296
+ model,
297
+ screenshotPaths
298
+ };
299
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/sliceTemplates/Hero/index.ts"],"sourcesContent":["import type { SharedSlice } from \"@prismicio/types-internal/lib/customtypes\";\nimport { SharedSliceContent } from \"@prismicio/types-internal/lib/content\";\n\nexport const screenshotPaths = {\n\tdefault: \"Hero/screenshot-default.png\",\n\timageRight: \"Hero/screenshot-imageRight.png\",\n};\n\nexport const mocks: SharedSliceContent[] = [\n\t{\n\t\t__TYPE__: \"SharedSliceContent\",\n\t\tvariation: \"default\",\n\t\tprimary: {\n\t\t\ttitle: {\n\t\t\t\t__TYPE__: \"StructuredTextContent\",\n\t\t\t\tvalue: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"heading2\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\ttext: \"Build a website that keeps getting better\",\n\t\t\t\t\t\t\tspans: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdirection: \"ltr\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\teyebrowHeadline: {\n\t\t\t\t__TYPE__: \"FieldContent\",\n\t\t\t\ttype: \"Text\",\n\t\t\t\tvalue: \"Hero\",\n\t\t\t},\n\t\t\tdescription: {\n\t\t\t\t__TYPE__: \"StructuredTextContent\",\n\t\t\t\tvalue: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"paragraph\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\ttext: \"Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases\",\n\t\t\t\t\t\t\tspans: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdirection: \"ltr\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\timage: {\n\t\t\t\turl: \"https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85\",\n\t\t\t\torigin: {\n\t\t\t\t\tid: \"h5yMpgOI5nI\",\n\t\t\t\t\turl: \"https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85\",\n\t\t\t\t\twidth: 3710,\n\t\t\t\t\theight: 3710,\n\t\t\t\t},\n\t\t\t\twidth: 3710,\n\t\t\t\theight: 3710,\n\t\t\t\tedit: {\n\t\t\t\t\tbackground: \"transparent\",\n\t\t\t\t\tzoom: 1,\n\t\t\t\t\tcrop: {\n\t\t\t\t\t\tx: 0,\n\t\t\t\t\t\ty: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcredits: null,\n\t\t\t\talt: \"Image Content\",\n\t\t\t\t__TYPE__: \"ImageContent\",\n\t\t\t\tthumbnails: {},\n\t\t\t},\n\t\t\tcallToActionLabel: {\n\t\t\t\t__TYPE__: \"FieldContent\",\n\t\t\t\ttype: \"Text\",\n\t\t\t\tvalue: \"Call to Action\",\n\t\t\t},\n\t\t\tcallToActionLink: {\n\t\t\t\t__TYPE__: \"LinkContent\",\n\t\t\t\tvalue: {\n\t\t\t\t\t__TYPE__: \"ExternalLink\",\n\t\t\t\t\turl: \"https://prismic.io\",\n\t\t\t\t\ttarget: \"\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\titems: [],\n\t},\n\t{\n\t\t__TYPE__: \"SharedSliceContent\",\n\t\tvariation: \"imageRight\",\n\t\tprimary: {\n\t\t\teyebrowHeadline: {\n\t\t\t\t__TYPE__: \"FieldContent\",\n\t\t\t\ttype: \"Text\",\n\t\t\t\tvalue: \"Image Right\",\n\t\t\t},\n\t\t\ttitle: {\n\t\t\t\t__TYPE__: \"StructuredTextContent\",\n\t\t\t\tvalue: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"heading1\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\ttext: \"Build a website\",\n\t\t\t\t\t\t\tspans: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdirection: \"ltr\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\tdescription: {\n\t\t\t\t__TYPE__: \"StructuredTextContent\",\n\t\t\t\tvalue: [\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"paragraph\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\ttext: \"Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases, including Image Right slice variations!\",\n\t\t\t\t\t\t\tspans: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdirection: \"ltr\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"paragraph\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\ttext: \"\\nBy the way: this RichText field supports multi-paragraph!\",\n\t\t\t\t\t\t\tspans: [],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdirection: \"ltr\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\timage: {\n\t\t\t\torigin: {\n\t\t\t\t\tid: \"euqiHwS38Rw\",\n\t\t\t\t\turl: \"https://images.unsplash.com/photo-1595475207225-428b62bda831?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHwyMHx8ZnJ1aXR8ZW58MHx8fHwxNjk0NDQyOTc2fDA&ixlib=rb-4.0.3&q=85\",\n\t\t\t\t\twidth: 2500,\n\t\t\t\t\theight: 2500,\n\t\t\t\t},\n\t\t\t\turl: \"https://images.unsplash.com/photo-1595475207225-428b62bda831?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHwyMHx8ZnJ1aXR8ZW58MHx8fHwxNjk0NDQyOTc2fDA&ixlib=rb-4.0.3&q=85\",\n\t\t\t\twidth: 2500,\n\t\t\t\theight: 2500,\n\t\t\t\tedit: {\n\t\t\t\t\tbackground: \"transparent\",\n\t\t\t\t\tzoom: 1,\n\t\t\t\t\tcrop: {\n\t\t\t\t\t\tx: 0,\n\t\t\t\t\t\ty: 0,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcredits: null,\n\t\t\t\talt: \"Image Content\",\n\t\t\t\t__TYPE__: \"ImageContent\",\n\t\t\t\tthumbnails: {},\n\t\t\t},\n\t\t\tcallToActionLabel: {\n\t\t\t\t__TYPE__: \"FieldContent\",\n\t\t\t\ttype: \"Text\",\n\t\t\t\tvalue: \"Call to Action\",\n\t\t\t},\n\t\t\tcallToActionLink: {\n\t\t\t\t__TYPE__: \"LinkContent\",\n\t\t\t\tvalue: {\n\t\t\t\t\t__TYPE__: \"ExternalLink\",\n\t\t\t\t\turl: \"https://prismic.io\",\n\t\t\t\t\ttarget: \"\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\titems: [\n\t\t\t{\n\t\t\t\t__TYPE__: \"GroupItemContent\",\n\t\t\t\tvalue: [],\n\t\t\t},\n\t\t],\n\t},\n];\n\nexport const model: SharedSlice = {\n\tid: \"hero\",\n\ttype: \"SharedSlice\",\n\tname: \"Hero\",\n\tdescription: \"Hero\",\n\tvariations: [\n\t\t{\n\t\t\tid: \"default\",\n\t\t\tname: \"Default\",\n\t\t\tdocURL: \"...\",\n\t\t\tversion: \"initial\",\n\t\t\tdescription: \"Default\",\n\t\t\timageUrl: \"\",\n\t\t\tprimary: {\n\t\t\t\teyebrowHeadline: {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"eyebrowHeadline\",\n\t\t\t\t\t\tplaceholder: \"Eyebrow\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\ttype: \"StructuredText\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"title\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tallowTargetBlank: true,\n\t\t\t\t\t\tsingle:\n\t\t\t\t\t\t\t\"heading1,heading2,heading3,heading4,heading5,heading6,strong,em\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: \"StructuredText\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"description\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tallowTargetBlank: true,\n\t\t\t\t\t\tmulti:\n\t\t\t\t\t\t\t\"paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\timage: {\n\t\t\t\t\ttype: \"Image\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"image\",\n\t\t\t\t\t\tconstraint: {},\n\t\t\t\t\t\tthumbnails: [],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcallToActionLabel: {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"callToActionLabel\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcallToActionLink: {\n\t\t\t\t\ttype: \"Link\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"callToActionLink\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tselect: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\titems: {},\n\t\t},\n\t\t{\n\t\t\tid: \"imageRight\",\n\t\t\tname: \"Image Right\",\n\t\t\tdocURL: \"...\",\n\t\t\tversion: \"initial\",\n\t\t\tdescription: \"Default\",\n\t\t\timageUrl: \"\",\n\t\t\tprimary: {\n\t\t\t\teyebrowHeadline: {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"eyebrowHeadline\",\n\t\t\t\t\t\tplaceholder: \"Eyebrow\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\ttype: \"StructuredText\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"title\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tallowTargetBlank: true,\n\t\t\t\t\t\tsingle:\n\t\t\t\t\t\t\t\"heading1,heading2,heading3,heading4,heading5,heading6,strong,em\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: \"StructuredText\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"description\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tallowTargetBlank: true,\n\t\t\t\t\t\tmulti:\n\t\t\t\t\t\t\t\"paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\timage: {\n\t\t\t\t\ttype: \"Image\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"image\",\n\t\t\t\t\t\tconstraint: {},\n\t\t\t\t\t\tthumbnails: [],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcallToActionLabel: {\n\t\t\t\t\ttype: \"Text\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"callToActionLabel\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tcallToActionLink: {\n\t\t\t\t\ttype: \"Link\",\n\t\t\t\t\tconfig: {\n\t\t\t\t\t\tlabel: \"callToActionLink\",\n\t\t\t\t\t\tplaceholder: \"\",\n\t\t\t\t\t\tselect: null,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\titems: {},\n\t\t},\n\t],\n};\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB;AAAA,EAC9B,SAAS;AAAA,EACT,YAAY;;AAGN,MAAM,QAA8B;AAAA,EAC1C;AAAA,IACC,UAAU;AAAA,IACV,WAAW;AAAA,IACX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,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,aAAa;AAAA,UACb;AAAA,QACD;AAAA,QACD,OAAO;AAAA,UACN,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,aAAa;AAAA,YACb,kBAAkB;AAAA,YAClB,QACC;AAAA,UACD;AAAA,QACD;AAAA,QACD,aAAa;AAAA,UACZ,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,aAAa;AAAA,YACb,kBAAkB;AAAA,YAClB,OACC;AAAA,UACD;AAAA,QACD;AAAA,QACD,OAAO;AAAA,UACN,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,YAAY,CAAE;AAAA,YACd,YAAY,CAAE;AAAA,UACd;AAAA,QACD;AAAA,QACD,mBAAmB;AAAA,UAClB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,aAAa;AAAA,UACb;AAAA,QACD;AAAA,QACD,kBAAkB;AAAA,UACjB,MAAM;AAAA,UACN,QAAQ;AAAA,YACP,OAAO;AAAA,YACP,aAAa;AAAA,YACb,QAAQ;AAAA,UACR;AAAA,QACD;AAAA,MACD;AAAA,MACD,OAAO,CAAE;AAAA,IACT;AAAA,EACD;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slicemachine/adapter-sveltekit",
3
- "version": "0.3.18-dev-next-release.2",
3
+ "version": "0.3.18-dev-next-release.4",
4
4
  "description": "Slice Machine adapter for SvelteKit.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -64,7 +64,7 @@
64
64
  "dependencies": {
65
65
  "@prismicio/simulator": "^0.1.4",
66
66
  "@prismicio/types-internal": "^2.0.0",
67
- "@slicemachine/plugin-kit": "^0.4.18-dev-next-release.2",
67
+ "@slicemachine/plugin-kit": "^0.4.18-dev-next-release.4",
68
68
  "common-tags": "^1.8.2",
69
69
  "fp-ts": "^2.13.1",
70
70
  "io-ts": "^2.2.20",
@@ -109,5 +109,5 @@
109
109
  "engines": {
110
110
  "node": ">=14.15.0"
111
111
  },
112
- "gitHead": "c6be820dae935dd1472219d352533c36701a6e0d"
112
+ "gitHead": "2b827ed877c339e06cac157c6be0fc70f6a284f0"
113
113
  }
@@ -0,0 +1,141 @@
1
+ import { source } from "common-tags";
2
+
3
+ import type { DocumentationReadHook } from "@slicemachine/plugin-kit";
4
+
5
+ import { getJSFileExtension } from "../lib/getJSFileExtension";
6
+
7
+ import type { PluginOptions } from "../types";
8
+
9
+ const nestRouteFilePath = (filePath: string, nesting: string): string => {
10
+ return [
11
+ ...filePath.split("/").slice(0, 2),
12
+ nesting,
13
+ ...filePath.split("/").slice(2),
14
+ ].join("/");
15
+ };
16
+
17
+ export const documentationRead: DocumentationReadHook<PluginOptions> = async (
18
+ data,
19
+ { options, helpers },
20
+ ) => {
21
+ if (data.kind === "PageSnippet") {
22
+ const { model } = data.data;
23
+
24
+ const pageDataExtension = await getJSFileExtension({ helpers, options });
25
+
26
+ const routePath = `src/routes/${model.repeatable ? "[uid]" : model.id}`;
27
+ const dataFilePath = `${routePath}/+page.server.${pageDataExtension}`;
28
+ const componentFilePath = `${routePath}/+page.svelte`;
29
+
30
+ let dataFileContent: string;
31
+ if (model.repeatable) {
32
+ dataFileContent = source`
33
+ import { createClient } from "$lib/prismicio";
34
+
35
+ export const prerender = true;
36
+
37
+ export async function load({ params, fetch }) {
38
+ const client = createClient({ fetch });
39
+
40
+ const page = await client.getByUID("${model.id}", params.uid);
41
+
42
+ return {
43
+ page,
44
+ };
45
+ }
46
+
47
+ export async function entries() {
48
+ const client = createClient();
49
+
50
+ const pages = await client.getAllByType("${model.id}");
51
+
52
+ return pages.map((page) => {
53
+ return { uid: page.uid };
54
+ });
55
+ }
56
+ `;
57
+ } else {
58
+ dataFileContent = source`
59
+ import { createClient } from "$lib/prismicio";
60
+
61
+ export const prerender = true;
62
+
63
+ export async function load({ params, fetch }) {
64
+ const client = createClient({ fetch });
65
+
66
+ const page = await client.getSingle("${model.id}");
67
+
68
+ return {
69
+ page,
70
+ };
71
+ }
72
+ `;
73
+ }
74
+
75
+ let componentFileContent = source`
76
+ <script>
77
+ import { SliceZone } from "@prismicio/svelte";
78
+
79
+ import { components } from "$lib/slices";
80
+
81
+ export let data;
82
+ </script>
83
+
84
+ <SliceZone slices={data.page.data.slices} {components} />
85
+ `;
86
+
87
+ if (options.format) {
88
+ dataFileContent = await helpers.format(
89
+ dataFileContent,
90
+ helpers.joinPathFromRoot(dataFilePath),
91
+ {
92
+ includeNewlineAtEnd: false,
93
+ },
94
+ );
95
+ componentFileContent = await helpers.format(
96
+ componentFileContent,
97
+ helpers.joinPathFromRoot(componentFilePath),
98
+ {
99
+ prettier: {
100
+ plugins: ["prettier-plugin-svelte"],
101
+ parser: "svelte",
102
+ },
103
+ includeNewlineAtEnd: false,
104
+ },
105
+ );
106
+ }
107
+
108
+ const nestedDataFilePath = nestRouteFilePath(dataFilePath, "marketing");
109
+ const nestedComponentFilePath = nestRouteFilePath(
110
+ componentFilePath,
111
+ "marketing",
112
+ );
113
+
114
+ return [
115
+ {
116
+ label: "Default",
117
+ content: source`
118
+ ## Create your ${model.label}'s page data fetcher
119
+
120
+ Add 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}\`.)
121
+
122
+ Paste in this code:
123
+
124
+ ${`~~~${pageDataExtension} [${dataFilePath}]\n${dataFileContent}\n~~~`}
125
+
126
+ ## Create your ${model.label}'s page component
127
+
128
+ In 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}\`.)
129
+
130
+ Paste in this code:
131
+
132
+ ${`~~~svelte [${componentFilePath}]\n${componentFileContent}\n~~~`}
133
+
134
+ Make sure all of your import paths are correct. See the [install guide](https://prismic.io/docs/svelte-install) for more information.
135
+ `,
136
+ },
137
+ ];
138
+ }
139
+
140
+ return [];
141
+ };
package/src/plugin.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
1
4
  import { defineSliceMachinePlugin } from "@slicemachine/plugin-kit";
2
5
  import {
3
6
  deleteCustomTypeDirectory,
@@ -10,6 +13,7 @@ import {
10
13
  readSliceFile,
11
14
  readSliceLibrary,
12
15
  readSliceModel,
16
+ readSliceTemplateLibrary,
13
17
  renameSlice,
14
18
  upsertGlobalTypeScriptTypes,
15
19
  writeCustomTypeFile,
@@ -24,11 +28,14 @@ import { upsertSliceLibraryIndexFile } from "./lib/upsertSliceLibraryIndexFile";
24
28
  import { name as pkgName } from "../package.json";
25
29
  import { PluginOptions } from "./types";
26
30
 
31
+ import { documentationRead } from "./hooks/documentation-read";
27
32
  import { projectInit } from "./hooks/project-init";
28
33
  import { sliceCreate } from "./hooks/slice-create";
29
34
  import { sliceSimulatorSetupRead } from "./hooks/sliceSimulator-setup-read";
30
35
  import { snippetRead } from "./hooks/snippet-read";
31
36
 
37
+ import * as Hero from "./sliceTemplates/Hero";
38
+
32
39
  export const plugin = defineSliceMachinePlugin<PluginOptions>({
33
40
  meta: {
34
41
  name: pkgName,
@@ -153,6 +160,23 @@ export const plugin = defineSliceMachinePlugin<PluginOptions>({
153
160
  });
154
161
  });
155
162
 
163
+ ////////////////////////////////////////////////////////////////
164
+ // slice-template-library:*
165
+ ////////////////////////////////////////////////////////////////
166
+
167
+ hook("slice-template-library:read", async (data, context) => {
168
+ return await readSliceTemplateLibrary({
169
+ ...data,
170
+ ...context,
171
+ dirName: path.dirname(fileURLToPath(new URL(import.meta.url))),
172
+ templates: [Hero],
173
+ componentFileNames: {
174
+ js: "javascript.svelte",
175
+ ts: "typescript.svelte",
176
+ },
177
+ });
178
+ });
179
+
156
180
  ////////////////////////////////////////////////////////////////
157
181
  // custom-type:*
158
182
  ////////////////////////////////////////////////////////////////
@@ -261,10 +285,7 @@ export const plugin = defineSliceMachinePlugin<PluginOptions>({
261
285
  // documentation:*
262
286
  ////////////////////////////////////////////////////////////////
263
287
 
264
- hook("documentation:read", async (_data, _context) => {
265
- // TODO
266
- return [];
267
- });
288
+ hook("documentation:read", documentationRead);
268
289
 
269
290
  ////////////////////////////////////////////////////////////////
270
291
  // slice-simulator:*