@slicemachine/adapter-nuxt 0.3.18-dev-next-release.5 → 0.3.18-dev-next-release.8

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.
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
  renameCustomType,
14
18
  renameSlice,
15
19
  upsertGlobalTypeScriptTypes,
@@ -31,6 +35,8 @@ import { sliceCreate } from "./hooks/slice-create";
31
35
  import { sliceSimulatorSetupRead } from "./hooks/sliceSimulator-setup-read";
32
36
  import { snippetRead } from "./hooks/snippet-read";
33
37
 
38
+ import * as Hero from "./sliceTemplates/Hero";
39
+
34
40
  export const plugin = defineSliceMachinePlugin<PluginOptions>({
35
41
  meta: {
36
42
  name: pkgName,
@@ -155,6 +161,23 @@ export const plugin = defineSliceMachinePlugin<PluginOptions>({
155
161
  });
156
162
  });
157
163
 
164
+ ////////////////////////////////////////////////////////////////
165
+ // slice-template-library:*
166
+ ////////////////////////////////////////////////////////////////
167
+
168
+ hook("slice-template-library:read", async (data, context) => {
169
+ return await readSliceTemplateLibrary({
170
+ ...data,
171
+ ...context,
172
+ dirName: path.dirname(fileURLToPath(new URL(import.meta.url))),
173
+ templates: [Hero],
174
+ componentFileNames: {
175
+ js: "javascript.vue",
176
+ ts: "typescript.vue",
177
+ },
178
+ });
179
+ });
180
+
158
181
  ////////////////////////////////////////////////////////////////
159
182
  // custom-type:*
160
183
  ////////////////////////////////////////////////////////////////
@@ -0,0 +1,302 @@
1
+ import type { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
2
+ import { SharedSliceContent } from "@prismicio/types-internal/lib/content";
3
+
4
+ export const screenshotPaths = {
5
+ default: "Hero/screenshot-default.png",
6
+ imageRight: "Hero/screenshot-imageRight.png",
7
+ };
8
+
9
+ export const mocks: SharedSliceContent[] = [
10
+ {
11
+ __TYPE__: "SharedSliceContent",
12
+ variation: "default",
13
+ primary: {
14
+ title: {
15
+ __TYPE__: "StructuredTextContent",
16
+ value: [
17
+ {
18
+ type: "heading2",
19
+ content: {
20
+ text: "Build a website that keeps getting better",
21
+ spans: [],
22
+ },
23
+ direction: "ltr",
24
+ },
25
+ ],
26
+ },
27
+ eyebrowHeadline: {
28
+ __TYPE__: "FieldContent",
29
+ type: "Text",
30
+ value: "Hero",
31
+ },
32
+ description: {
33
+ __TYPE__: "StructuredTextContent",
34
+ value: [
35
+ {
36
+ type: "paragraph",
37
+ content: {
38
+ text: "Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases",
39
+ spans: [],
40
+ },
41
+ direction: "ltr",
42
+ },
43
+ ],
44
+ },
45
+ image: {
46
+ url: "https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85",
47
+ origin: {
48
+ id: "h5yMpgOI5nI",
49
+ url: "https://images.unsplash.com/photo-1584559582128-b8be739912e1?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHw5fHxmcnVpdHxlbnwwfHx8fDE2OTQ0NDI5NzZ8MA&ixlib=rb-4.0.3&q=85",
50
+ width: 3710,
51
+ height: 3710,
52
+ },
53
+ width: 3710,
54
+ height: 3710,
55
+ edit: {
56
+ background: "transparent",
57
+ zoom: 1,
58
+ crop: {
59
+ x: 0,
60
+ y: 0,
61
+ },
62
+ },
63
+ credits: null,
64
+ alt: "Image Content",
65
+ __TYPE__: "ImageContent",
66
+ thumbnails: {},
67
+ },
68
+ callToActionLabel: {
69
+ __TYPE__: "FieldContent",
70
+ type: "Text",
71
+ value: "Call to Action",
72
+ },
73
+ callToActionLink: {
74
+ __TYPE__: "LinkContent",
75
+ value: {
76
+ __TYPE__: "ExternalLink",
77
+ url: "https://prismic.io",
78
+ target: "",
79
+ },
80
+ },
81
+ },
82
+ items: [],
83
+ },
84
+ {
85
+ __TYPE__: "SharedSliceContent",
86
+ variation: "imageRight",
87
+ primary: {
88
+ eyebrowHeadline: {
89
+ __TYPE__: "FieldContent",
90
+ type: "Text",
91
+ value: "Image Right",
92
+ },
93
+ title: {
94
+ __TYPE__: "StructuredTextContent",
95
+ value: [
96
+ {
97
+ type: "heading1",
98
+ content: {
99
+ text: "Build a website",
100
+ spans: [],
101
+ },
102
+ direction: "ltr",
103
+ },
104
+ ],
105
+ },
106
+ description: {
107
+ __TYPE__: "StructuredTextContent",
108
+ value: [
109
+ {
110
+ type: "paragraph",
111
+ content: {
112
+ text: "Learn how prismic.io helps thousands of businesses around the world with some of our customers’ use-cases, including Image Right slice variations!",
113
+ spans: [],
114
+ },
115
+ direction: "ltr",
116
+ },
117
+ {
118
+ type: "paragraph",
119
+ content: {
120
+ text: "\nBy the way: this RichText field supports multi-paragraph!",
121
+ spans: [],
122
+ },
123
+ direction: "ltr",
124
+ },
125
+ ],
126
+ },
127
+ image: {
128
+ origin: {
129
+ id: "euqiHwS38Rw",
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
+ },
134
+ url: "https://images.unsplash.com/photo-1595475207225-428b62bda831?crop=entropy&cs=srgb&fm=jpg&ixid=M3wzMzc0NjN8MHwxfHNlYXJjaHwyMHx8ZnJ1aXR8ZW58MHx8fHwxNjk0NDQyOTc2fDA&ixlib=rb-4.0.3&q=85",
135
+ width: 2500,
136
+ height: 2500,
137
+ edit: {
138
+ background: "transparent",
139
+ zoom: 1,
140
+ crop: {
141
+ x: 0,
142
+ y: 0,
143
+ },
144
+ },
145
+ credits: null,
146
+ alt: "Image Content",
147
+ __TYPE__: "ImageContent",
148
+ thumbnails: {},
149
+ },
150
+ callToActionLabel: {
151
+ __TYPE__: "FieldContent",
152
+ type: "Text",
153
+ value: "Call to Action",
154
+ },
155
+ callToActionLink: {
156
+ __TYPE__: "LinkContent",
157
+ value: {
158
+ __TYPE__: "ExternalLink",
159
+ url: "https://prismic.io",
160
+ target: "",
161
+ },
162
+ },
163
+ },
164
+ items: [
165
+ {
166
+ __TYPE__: "GroupItemContent",
167
+ value: [],
168
+ },
169
+ ],
170
+ },
171
+ ];
172
+
173
+ export const model: SharedSlice = {
174
+ id: "hero",
175
+ type: "SharedSlice",
176
+ name: "Hero",
177
+ description: "Hero",
178
+ variations: [
179
+ {
180
+ id: "default",
181
+ name: "Default",
182
+ docURL: "...",
183
+ version: "initial",
184
+ description: "Default",
185
+ imageUrl: "",
186
+ primary: {
187
+ eyebrowHeadline: {
188
+ type: "Text",
189
+ config: {
190
+ label: "eyebrowHeadline",
191
+ placeholder: "Eyebrow",
192
+ },
193
+ },
194
+ title: {
195
+ type: "StructuredText",
196
+ config: {
197
+ label: "title",
198
+ placeholder: "",
199
+ allowTargetBlank: true,
200
+ single:
201
+ "heading1,heading2,heading3,heading4,heading5,heading6,strong,em",
202
+ },
203
+ },
204
+ description: {
205
+ type: "StructuredText",
206
+ config: {
207
+ label: "description",
208
+ placeholder: "",
209
+ allowTargetBlank: true,
210
+ multi:
211
+ "paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item",
212
+ },
213
+ },
214
+ image: {
215
+ type: "Image",
216
+ config: {
217
+ label: "image",
218
+ constraint: {},
219
+ thumbnails: [],
220
+ },
221
+ },
222
+ callToActionLabel: {
223
+ type: "Text",
224
+ config: {
225
+ label: "callToActionLabel",
226
+ placeholder: "",
227
+ },
228
+ },
229
+ callToActionLink: {
230
+ type: "Link",
231
+ config: {
232
+ label: "callToActionLink",
233
+ placeholder: "",
234
+ select: null,
235
+ },
236
+ },
237
+ },
238
+ items: {},
239
+ },
240
+ {
241
+ id: "imageRight",
242
+ name: "Image Right",
243
+ docURL: "...",
244
+ version: "initial",
245
+ description: "Default",
246
+ imageUrl: "",
247
+ primary: {
248
+ eyebrowHeadline: {
249
+ type: "Text",
250
+ config: {
251
+ label: "eyebrowHeadline",
252
+ placeholder: "Eyebrow",
253
+ },
254
+ },
255
+ title: {
256
+ type: "StructuredText",
257
+ config: {
258
+ label: "title",
259
+ placeholder: "",
260
+ allowTargetBlank: true,
261
+ single:
262
+ "heading1,heading2,heading3,heading4,heading5,heading6,strong,em",
263
+ },
264
+ },
265
+ description: {
266
+ type: "StructuredText",
267
+ config: {
268
+ label: "description",
269
+ placeholder: "",
270
+ allowTargetBlank: true,
271
+ multi:
272
+ "paragraph,preformatted,hyperlink,embed,rtl,strong,em,list-item,o-list-item",
273
+ },
274
+ },
275
+ image: {
276
+ type: "Image",
277
+ config: {
278
+ label: "image",
279
+ constraint: {},
280
+ thumbnails: [],
281
+ },
282
+ },
283
+ callToActionLabel: {
284
+ type: "Text",
285
+ config: {
286
+ label: "callToActionLabel",
287
+ placeholder: "",
288
+ },
289
+ },
290
+ callToActionLink: {
291
+ type: "Link",
292
+ config: {
293
+ label: "callToActionLink",
294
+ placeholder: "",
295
+ select: null,
296
+ },
297
+ },
298
+ },
299
+ items: {},
300
+ },
301
+ ],
302
+ };