@replohq/canopy-sdk 0.1.2 → 0.1.3
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/_vendor/schemas/designLibrary.d.ts +333 -0
- package/_vendor/schemas/designLibrary.mjs +108 -0
- package/_vendor/schemas/savedStyles.d.ts +140 -0
- package/editor/design-library-preview/DesignLibraryPreview.d.ts +1 -0
- package/editor/design-library-preview/DesignLibraryPreview.js +31 -0
- package/editor/design-library-preview/DesignLibraryPreview.js.map +7 -0
- package/package.json +1 -1
- package/providers/replo-provider.js +2 -0
- package/providers/replo-provider.js.map +2 -2
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const savedColorStyleSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"color">;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
attributes: z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"color">;
|
|
7
|
+
color: z.ZodString;
|
|
8
|
+
colorType: z.ZodEnum<{
|
|
9
|
+
basic: "basic";
|
|
10
|
+
foregroundPrimary: "foregroundPrimary";
|
|
11
|
+
foregroundSecondary: "foregroundSecondary";
|
|
12
|
+
foregroundTertiary: "foregroundTertiary";
|
|
13
|
+
backgroundPrimary: "backgroundPrimary";
|
|
14
|
+
backgroundSecondary: "backgroundSecondary";
|
|
15
|
+
backgroundTertiary: "backgroundTertiary";
|
|
16
|
+
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
20
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const savedTextStyleSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"text">;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
attributes: z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"text">;
|
|
27
|
+
htmlTag: z.ZodEnum<{
|
|
28
|
+
h1: "h1";
|
|
29
|
+
h2: "h2";
|
|
30
|
+
h3: "h3";
|
|
31
|
+
h4: "h4";
|
|
32
|
+
h5: "h5";
|
|
33
|
+
h6: "h6";
|
|
34
|
+
p: "p";
|
|
35
|
+
}>;
|
|
36
|
+
color: z.ZodOptional<z.ZodString>;
|
|
37
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
38
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
39
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
100: "100";
|
|
41
|
+
200: "200";
|
|
42
|
+
300: "300";
|
|
43
|
+
400: "400";
|
|
44
|
+
500: "500";
|
|
45
|
+
600: "600";
|
|
46
|
+
700: "700";
|
|
47
|
+
800: "800";
|
|
48
|
+
900: "900";
|
|
49
|
+
950: "950";
|
|
50
|
+
}>>;
|
|
51
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
52
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
53
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
54
|
+
left: "left";
|
|
55
|
+
right: "right";
|
|
56
|
+
center: "center";
|
|
57
|
+
}>>;
|
|
58
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
59
|
+
none: "none";
|
|
60
|
+
underline: "underline";
|
|
61
|
+
"line-through": "line-through";
|
|
62
|
+
italic: "italic";
|
|
63
|
+
}>>;
|
|
64
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
65
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
66
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
none: "none";
|
|
68
|
+
lowercase: "lowercase";
|
|
69
|
+
uppercase: "uppercase";
|
|
70
|
+
capitalize: "capitalize";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
75
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
export declare const designLibrarySavedStylesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
78
|
+
type: z.ZodLiteral<"color">;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
attributes: z.ZodObject<{
|
|
81
|
+
type: z.ZodLiteral<"color">;
|
|
82
|
+
color: z.ZodString;
|
|
83
|
+
colorType: z.ZodEnum<{
|
|
84
|
+
basic: "basic";
|
|
85
|
+
foregroundPrimary: "foregroundPrimary";
|
|
86
|
+
foregroundSecondary: "foregroundSecondary";
|
|
87
|
+
foregroundTertiary: "foregroundTertiary";
|
|
88
|
+
backgroundPrimary: "backgroundPrimary";
|
|
89
|
+
backgroundSecondary: "backgroundSecondary";
|
|
90
|
+
backgroundTertiary: "backgroundTertiary";
|
|
91
|
+
}>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
95
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"text">;
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
attributes: z.ZodObject<{
|
|
100
|
+
type: z.ZodLiteral<"text">;
|
|
101
|
+
htmlTag: z.ZodEnum<{
|
|
102
|
+
h1: "h1";
|
|
103
|
+
h2: "h2";
|
|
104
|
+
h3: "h3";
|
|
105
|
+
h4: "h4";
|
|
106
|
+
h5: "h5";
|
|
107
|
+
h6: "h6";
|
|
108
|
+
p: "p";
|
|
109
|
+
}>;
|
|
110
|
+
color: z.ZodOptional<z.ZodString>;
|
|
111
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
112
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
113
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
100: "100";
|
|
115
|
+
200: "200";
|
|
116
|
+
300: "300";
|
|
117
|
+
400: "400";
|
|
118
|
+
500: "500";
|
|
119
|
+
600: "600";
|
|
120
|
+
700: "700";
|
|
121
|
+
800: "800";
|
|
122
|
+
900: "900";
|
|
123
|
+
950: "950";
|
|
124
|
+
}>>;
|
|
125
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
126
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
127
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
128
|
+
left: "left";
|
|
129
|
+
right: "right";
|
|
130
|
+
center: "center";
|
|
131
|
+
}>>;
|
|
132
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
133
|
+
none: "none";
|
|
134
|
+
underline: "underline";
|
|
135
|
+
"line-through": "line-through";
|
|
136
|
+
italic: "italic";
|
|
137
|
+
}>>;
|
|
138
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
139
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
140
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
141
|
+
none: "none";
|
|
142
|
+
lowercase: "lowercase";
|
|
143
|
+
uppercase: "uppercase";
|
|
144
|
+
capitalize: "capitalize";
|
|
145
|
+
}>>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
148
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
149
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strip>]>>;
|
|
151
|
+
export declare const designLibrarySchema: z.ZodObject<{
|
|
152
|
+
id: z.ZodUUID;
|
|
153
|
+
createdAt: z.ZodDate;
|
|
154
|
+
updatedAt: z.ZodDate;
|
|
155
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
156
|
+
savedStyles: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
157
|
+
type: z.ZodLiteral<"color">;
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
attributes: z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"color">;
|
|
161
|
+
color: z.ZodString;
|
|
162
|
+
colorType: z.ZodEnum<{
|
|
163
|
+
basic: "basic";
|
|
164
|
+
foregroundPrimary: "foregroundPrimary";
|
|
165
|
+
foregroundSecondary: "foregroundSecondary";
|
|
166
|
+
foregroundTertiary: "foregroundTertiary";
|
|
167
|
+
backgroundPrimary: "backgroundPrimary";
|
|
168
|
+
backgroundSecondary: "backgroundSecondary";
|
|
169
|
+
backgroundTertiary: "backgroundTertiary";
|
|
170
|
+
}>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
173
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
174
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"text">;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
attributes: z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"text">;
|
|
180
|
+
htmlTag: z.ZodEnum<{
|
|
181
|
+
h1: "h1";
|
|
182
|
+
h2: "h2";
|
|
183
|
+
h3: "h3";
|
|
184
|
+
h4: "h4";
|
|
185
|
+
h5: "h5";
|
|
186
|
+
h6: "h6";
|
|
187
|
+
p: "p";
|
|
188
|
+
}>;
|
|
189
|
+
color: z.ZodOptional<z.ZodString>;
|
|
190
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
191
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
192
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
193
|
+
100: "100";
|
|
194
|
+
200: "200";
|
|
195
|
+
300: "300";
|
|
196
|
+
400: "400";
|
|
197
|
+
500: "500";
|
|
198
|
+
600: "600";
|
|
199
|
+
700: "700";
|
|
200
|
+
800: "800";
|
|
201
|
+
900: "900";
|
|
202
|
+
950: "950";
|
|
203
|
+
}>>;
|
|
204
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
205
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
206
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
207
|
+
left: "left";
|
|
208
|
+
right: "right";
|
|
209
|
+
center: "center";
|
|
210
|
+
}>>;
|
|
211
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
212
|
+
none: "none";
|
|
213
|
+
underline: "underline";
|
|
214
|
+
"line-through": "line-through";
|
|
215
|
+
italic: "italic";
|
|
216
|
+
}>>;
|
|
217
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
218
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
219
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
220
|
+
none: "none";
|
|
221
|
+
lowercase: "lowercase";
|
|
222
|
+
uppercase: "uppercase";
|
|
223
|
+
capitalize: "capitalize";
|
|
224
|
+
}>>;
|
|
225
|
+
}, z.core.$strip>;
|
|
226
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
227
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
228
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
229
|
+
}, z.core.$strip>]>>;
|
|
230
|
+
}, z.core.$strip>;
|
|
231
|
+
export declare const designLibrarySavedStyleMetadataSchema: z.ZodObject<{
|
|
232
|
+
library: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
233
|
+
styles: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
234
|
+
type: z.ZodLiteral<"color">;
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
attributes: z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"color">;
|
|
238
|
+
color: z.ZodString;
|
|
239
|
+
colorType: z.ZodEnum<{
|
|
240
|
+
basic: "basic";
|
|
241
|
+
foregroundPrimary: "foregroundPrimary";
|
|
242
|
+
foregroundSecondary: "foregroundSecondary";
|
|
243
|
+
foregroundTertiary: "foregroundTertiary";
|
|
244
|
+
backgroundPrimary: "backgroundPrimary";
|
|
245
|
+
backgroundSecondary: "backgroundSecondary";
|
|
246
|
+
backgroundTertiary: "backgroundTertiary";
|
|
247
|
+
}>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
251
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
+
type: z.ZodLiteral<"text">;
|
|
254
|
+
name: z.ZodString;
|
|
255
|
+
attributes: z.ZodObject<{
|
|
256
|
+
type: z.ZodLiteral<"text">;
|
|
257
|
+
htmlTag: z.ZodEnum<{
|
|
258
|
+
h1: "h1";
|
|
259
|
+
h2: "h2";
|
|
260
|
+
h3: "h3";
|
|
261
|
+
h4: "h4";
|
|
262
|
+
h5: "h5";
|
|
263
|
+
h6: "h6";
|
|
264
|
+
p: "p";
|
|
265
|
+
}>;
|
|
266
|
+
color: z.ZodOptional<z.ZodString>;
|
|
267
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
268
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
269
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
270
|
+
100: "100";
|
|
271
|
+
200: "200";
|
|
272
|
+
300: "300";
|
|
273
|
+
400: "400";
|
|
274
|
+
500: "500";
|
|
275
|
+
600: "600";
|
|
276
|
+
700: "700";
|
|
277
|
+
800: "800";
|
|
278
|
+
900: "900";
|
|
279
|
+
950: "950";
|
|
280
|
+
}>>;
|
|
281
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
282
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
283
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
284
|
+
left: "left";
|
|
285
|
+
right: "right";
|
|
286
|
+
center: "center";
|
|
287
|
+
}>>;
|
|
288
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
289
|
+
none: "none";
|
|
290
|
+
underline: "underline";
|
|
291
|
+
"line-through": "line-through";
|
|
292
|
+
italic: "italic";
|
|
293
|
+
}>>;
|
|
294
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
295
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
296
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
297
|
+
none: "none";
|
|
298
|
+
lowercase: "lowercase";
|
|
299
|
+
uppercase: "uppercase";
|
|
300
|
+
capitalize: "capitalize";
|
|
301
|
+
}>>;
|
|
302
|
+
}, z.core.$strip>;
|
|
303
|
+
optionalUsageGuidelines: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
304
|
+
deletedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
305
|
+
isPrimary: z.ZodOptional<z.ZodBoolean>;
|
|
306
|
+
}, z.core.$strip>]>>;
|
|
307
|
+
}, z.core.$strip>>;
|
|
308
|
+
}, z.core.$strip>;
|
|
309
|
+
export declare const globalsCssTokenSchema: z.ZodObject<{
|
|
310
|
+
name: z.ZodString;
|
|
311
|
+
value: z.ZodString;
|
|
312
|
+
}, z.core.$strip>;
|
|
313
|
+
export declare const globalsCssScopeSchema: z.ZodObject<{
|
|
314
|
+
selector: z.ZodString;
|
|
315
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
316
|
+
name: z.ZodString;
|
|
317
|
+
value: z.ZodString;
|
|
318
|
+
}, z.core.$strip>>;
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
export declare const globalsCssSnapshotSchema: z.ZodObject<{
|
|
321
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
322
|
+
selector: z.ZodString;
|
|
323
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
324
|
+
name: z.ZodString;
|
|
325
|
+
value: z.ZodString;
|
|
326
|
+
}, z.core.$strip>>;
|
|
327
|
+
}, z.core.$strip>>;
|
|
328
|
+
}, z.core.$strip>;
|
|
329
|
+
export declare const DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
|
|
330
|
+
export declare const designLibraryPreviewMessageSchema: z.ZodObject<{
|
|
331
|
+
type: z.ZodLiteral<"replo:design-library:applyOverrides">;
|
|
332
|
+
cssVars: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
333
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// ../schemas/designLibrary.ts
|
|
4
|
+
var colorTypeSchema = z.enum([
|
|
5
|
+
"basic",
|
|
6
|
+
"foregroundPrimary",
|
|
7
|
+
"foregroundSecondary",
|
|
8
|
+
"foregroundTertiary",
|
|
9
|
+
"backgroundPrimary",
|
|
10
|
+
"backgroundSecondary",
|
|
11
|
+
"backgroundTertiary"
|
|
12
|
+
]).describe("SavedStyleColorType");
|
|
13
|
+
var savedStyleColorAttributesSchema = z.object({
|
|
14
|
+
type: z.literal("color"),
|
|
15
|
+
color: z.string(),
|
|
16
|
+
colorType: colorTypeSchema
|
|
17
|
+
}).describe("SavedStyleColorAttributes");
|
|
18
|
+
var savedStyleTextHtmlTagSchema = z.enum([
|
|
19
|
+
"h1",
|
|
20
|
+
"h2",
|
|
21
|
+
"h3",
|
|
22
|
+
"h4",
|
|
23
|
+
"h5",
|
|
24
|
+
"h6",
|
|
25
|
+
"p"
|
|
26
|
+
]);
|
|
27
|
+
var savedStyleTextAttributesSchema = z.object({
|
|
28
|
+
type: z.literal("text"),
|
|
29
|
+
htmlTag: savedStyleTextHtmlTagSchema,
|
|
30
|
+
color: z.string().optional(),
|
|
31
|
+
fontFamily: z.string().nullish(),
|
|
32
|
+
fontSize: z.string().optional(),
|
|
33
|
+
fontWeight: z.enum([
|
|
34
|
+
"100",
|
|
35
|
+
"200",
|
|
36
|
+
"300",
|
|
37
|
+
"400",
|
|
38
|
+
"500",
|
|
39
|
+
"600",
|
|
40
|
+
"700",
|
|
41
|
+
"800",
|
|
42
|
+
"900",
|
|
43
|
+
"950"
|
|
44
|
+
]).optional(),
|
|
45
|
+
letterSpacing: z.string().optional(),
|
|
46
|
+
lineHeight: z.string().optional(),
|
|
47
|
+
textAlign: z.enum(["left", "center", "right"]).optional(),
|
|
48
|
+
textDecoration: z.enum(["underline", "line-through", "italic", "none"]).optional(),
|
|
49
|
+
textShadow: z.string().optional(),
|
|
50
|
+
textStroke: z.string().optional(),
|
|
51
|
+
textTransform: z.enum(["lowercase", "uppercase", "capitalize", "none"]).optional()
|
|
52
|
+
}).describe("SavedStyleTextAttributes");
|
|
53
|
+
z.discriminatedUnion("type", [
|
|
54
|
+
savedStyleColorAttributesSchema,
|
|
55
|
+
savedStyleTextAttributesSchema
|
|
56
|
+
]).describe("SavedStyleAttributes");
|
|
57
|
+
|
|
58
|
+
// ../schemas/designLibrary.ts
|
|
59
|
+
var savedColorStyleSchema = z.object({
|
|
60
|
+
type: z.literal("color"),
|
|
61
|
+
name: z.string(),
|
|
62
|
+
attributes: savedStyleColorAttributesSchema,
|
|
63
|
+
optionalUsageGuidelines: z.string().nullish(),
|
|
64
|
+
deletedAt: z.coerce.date().nullish(),
|
|
65
|
+
isPrimary: z.boolean().optional()
|
|
66
|
+
}).describe("SavedColorStyle");
|
|
67
|
+
var savedTextStyleSchema = z.object({
|
|
68
|
+
type: z.literal("text"),
|
|
69
|
+
name: z.string(),
|
|
70
|
+
attributes: savedStyleTextAttributesSchema,
|
|
71
|
+
optionalUsageGuidelines: z.string().nullish(),
|
|
72
|
+
deletedAt: z.coerce.date().nullish(),
|
|
73
|
+
isPrimary: z.boolean().optional()
|
|
74
|
+
}).describe("SavedTextStyle");
|
|
75
|
+
var designLibrarySavedStylesSchema = z.record(z.string(), z.union([savedColorStyleSchema, savedTextStyleSchema])).describe("DesignLibrarySavedStylesMapping");
|
|
76
|
+
var designLibrarySchema = z.object({
|
|
77
|
+
id: z.uuid(),
|
|
78
|
+
createdAt: z.date(),
|
|
79
|
+
updatedAt: z.date(),
|
|
80
|
+
deletedAt: z.coerce.date().nullish(),
|
|
81
|
+
savedStyles: designLibrarySavedStylesSchema
|
|
82
|
+
}).describe("DesignLibrary");
|
|
83
|
+
var designLibrarySavedStyleMetadataSchema = z.object({
|
|
84
|
+
library: z.record(
|
|
85
|
+
z.string(),
|
|
86
|
+
z.object({
|
|
87
|
+
styles: designLibrarySavedStylesSchema
|
|
88
|
+
})
|
|
89
|
+
)
|
|
90
|
+
}).describe("DesignLibrarySavedStyleMetadata");
|
|
91
|
+
var globalsCssTokenSchema = z.object({
|
|
92
|
+
name: z.string(),
|
|
93
|
+
value: z.string()
|
|
94
|
+
}).describe("GlobalsCssToken");
|
|
95
|
+
var globalsCssScopeSchema = z.object({
|
|
96
|
+
selector: z.string(),
|
|
97
|
+
tokens: z.array(globalsCssTokenSchema)
|
|
98
|
+
}).describe("GlobalsCssScope");
|
|
99
|
+
var globalsCssSnapshotSchema = z.object({
|
|
100
|
+
scopes: z.array(globalsCssScopeSchema)
|
|
101
|
+
}).describe("GlobalsCssSnapshot");
|
|
102
|
+
var DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
|
|
103
|
+
var designLibraryPreviewMessageSchema = z.object({
|
|
104
|
+
type: z.literal(DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE),
|
|
105
|
+
cssVars: z.record(z.string(), z.string())
|
|
106
|
+
}).describe("DesignLibraryPreviewMessage");
|
|
107
|
+
|
|
108
|
+
export { DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE, designLibraryPreviewMessageSchema, designLibrarySavedStyleMetadataSchema, designLibrarySavedStylesSchema, designLibrarySchema, globalsCssScopeSchema, globalsCssSnapshotSchema, globalsCssTokenSchema, savedColorStyleSchema, savedTextStyleSchema };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const colorTypeSchema: z.ZodEnum<{
|
|
3
|
+
basic: "basic";
|
|
4
|
+
foregroundPrimary: "foregroundPrimary";
|
|
5
|
+
foregroundSecondary: "foregroundSecondary";
|
|
6
|
+
foregroundTertiary: "foregroundTertiary";
|
|
7
|
+
backgroundPrimary: "backgroundPrimary";
|
|
8
|
+
backgroundSecondary: "backgroundSecondary";
|
|
9
|
+
backgroundTertiary: "backgroundTertiary";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const savedStyleColorAttributesSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodLiteral<"color">;
|
|
13
|
+
color: z.ZodString;
|
|
14
|
+
colorType: z.ZodEnum<{
|
|
15
|
+
basic: "basic";
|
|
16
|
+
foregroundPrimary: "foregroundPrimary";
|
|
17
|
+
foregroundSecondary: "foregroundSecondary";
|
|
18
|
+
foregroundTertiary: "foregroundTertiary";
|
|
19
|
+
backgroundPrimary: "backgroundPrimary";
|
|
20
|
+
backgroundSecondary: "backgroundSecondary";
|
|
21
|
+
backgroundTertiary: "backgroundTertiary";
|
|
22
|
+
}>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const savedStyleTextHtmlTagSchema: z.ZodEnum<{
|
|
25
|
+
h1: "h1";
|
|
26
|
+
h2: "h2";
|
|
27
|
+
h3: "h3";
|
|
28
|
+
h4: "h4";
|
|
29
|
+
h5: "h5";
|
|
30
|
+
h6: "h6";
|
|
31
|
+
p: "p";
|
|
32
|
+
}>;
|
|
33
|
+
export declare const savedStyleTextAttributesSchema: z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"text">;
|
|
35
|
+
htmlTag: z.ZodEnum<{
|
|
36
|
+
h1: "h1";
|
|
37
|
+
h2: "h2";
|
|
38
|
+
h3: "h3";
|
|
39
|
+
h4: "h4";
|
|
40
|
+
h5: "h5";
|
|
41
|
+
h6: "h6";
|
|
42
|
+
p: "p";
|
|
43
|
+
}>;
|
|
44
|
+
color: z.ZodOptional<z.ZodString>;
|
|
45
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
46
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
47
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
100: "100";
|
|
49
|
+
200: "200";
|
|
50
|
+
300: "300";
|
|
51
|
+
400: "400";
|
|
52
|
+
500: "500";
|
|
53
|
+
600: "600";
|
|
54
|
+
700: "700";
|
|
55
|
+
800: "800";
|
|
56
|
+
900: "900";
|
|
57
|
+
950: "950";
|
|
58
|
+
}>>;
|
|
59
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
60
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
61
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
left: "left";
|
|
63
|
+
right: "right";
|
|
64
|
+
center: "center";
|
|
65
|
+
}>>;
|
|
66
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
none: "none";
|
|
68
|
+
underline: "underline";
|
|
69
|
+
"line-through": "line-through";
|
|
70
|
+
italic: "italic";
|
|
71
|
+
}>>;
|
|
72
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
73
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
74
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
none: "none";
|
|
76
|
+
lowercase: "lowercase";
|
|
77
|
+
uppercase: "uppercase";
|
|
78
|
+
capitalize: "capitalize";
|
|
79
|
+
}>>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export declare const savedStyleAttributesSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
82
|
+
type: z.ZodLiteral<"color">;
|
|
83
|
+
color: z.ZodString;
|
|
84
|
+
colorType: z.ZodEnum<{
|
|
85
|
+
basic: "basic";
|
|
86
|
+
foregroundPrimary: "foregroundPrimary";
|
|
87
|
+
foregroundSecondary: "foregroundSecondary";
|
|
88
|
+
foregroundTertiary: "foregroundTertiary";
|
|
89
|
+
backgroundPrimary: "backgroundPrimary";
|
|
90
|
+
backgroundSecondary: "backgroundSecondary";
|
|
91
|
+
backgroundTertiary: "backgroundTertiary";
|
|
92
|
+
}>;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"text">;
|
|
95
|
+
htmlTag: z.ZodEnum<{
|
|
96
|
+
h1: "h1";
|
|
97
|
+
h2: "h2";
|
|
98
|
+
h3: "h3";
|
|
99
|
+
h4: "h4";
|
|
100
|
+
h5: "h5";
|
|
101
|
+
h6: "h6";
|
|
102
|
+
p: "p";
|
|
103
|
+
}>;
|
|
104
|
+
color: z.ZodOptional<z.ZodString>;
|
|
105
|
+
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
106
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
107
|
+
fontWeight: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
100: "100";
|
|
109
|
+
200: "200";
|
|
110
|
+
300: "300";
|
|
111
|
+
400: "400";
|
|
112
|
+
500: "500";
|
|
113
|
+
600: "600";
|
|
114
|
+
700: "700";
|
|
115
|
+
800: "800";
|
|
116
|
+
900: "900";
|
|
117
|
+
950: "950";
|
|
118
|
+
}>>;
|
|
119
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
120
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
121
|
+
textAlign: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
left: "left";
|
|
123
|
+
right: "right";
|
|
124
|
+
center: "center";
|
|
125
|
+
}>>;
|
|
126
|
+
textDecoration: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
none: "none";
|
|
128
|
+
underline: "underline";
|
|
129
|
+
"line-through": "line-through";
|
|
130
|
+
italic: "italic";
|
|
131
|
+
}>>;
|
|
132
|
+
textShadow: z.ZodOptional<z.ZodString>;
|
|
133
|
+
textStroke: z.ZodOptional<z.ZodString>;
|
|
134
|
+
textTransform: z.ZodOptional<z.ZodEnum<{
|
|
135
|
+
none: "none";
|
|
136
|
+
lowercase: "lowercase";
|
|
137
|
+
uppercase: "uppercase";
|
|
138
|
+
capitalize: "capitalize";
|
|
139
|
+
}>>;
|
|
140
|
+
}, z.core.$strip>], "type">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function DesignLibraryPreview(): null;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { designLibraryPreviewMessageSchema } from "../../_vendor/schemas/designLibrary.mjs";
|
|
4
|
+
function DesignLibraryPreview() {
|
|
5
|
+
const ownedKeys = useRef(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const handleMessage = (event) => {
|
|
8
|
+
const parsed = designLibraryPreviewMessageSchema.safeParse(event.data);
|
|
9
|
+
if (!parsed.success) return;
|
|
10
|
+
const next = parsed.data.cssVars;
|
|
11
|
+
const root = document.documentElement;
|
|
12
|
+
const owned = ownedKeys.current ?? /* @__PURE__ */ new Set();
|
|
13
|
+
for (const key of owned) {
|
|
14
|
+
if (!(key in next)) root.style.removeProperty(key);
|
|
15
|
+
}
|
|
16
|
+
ownedKeys.current = new Set(Object.keys(next));
|
|
17
|
+
for (const [key, value] of Object.entries(next)) {
|
|
18
|
+
root.style.setProperty(key, value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
window.addEventListener("message", handleMessage);
|
|
22
|
+
return () => {
|
|
23
|
+
window.removeEventListener("message", handleMessage);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
DesignLibraryPreview
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=DesignLibraryPreview.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../editor/design-library-preview/DesignLibraryPreview.tsx"],
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\n\nimport { designLibraryPreviewMessageSchema } from \"schemas/designLibrary\";\n\nexport function DesignLibraryPreview() {\n // NOTE (Ben, 2026-06-03): The custom-property keys we set last time, so on the\n // next message we remove only the ones we own that the new override set drops.\n const ownedKeys = useRef<Set<string> | null>(null);\n\n // eslint-disable-next-line replo/no-use-effect -- Subscribes to window message events from the parent editor.\n useEffect(() => {\n const handleMessage = (event: MessageEvent) => {\n const parsed = designLibraryPreviewMessageSchema.safeParse(event.data);\n if (!parsed.success) return;\n const next = parsed.data.cssVars;\n const root = document.documentElement;\n const owned = ownedKeys.current ?? new Set();\n for (const key of owned) {\n if (!(key in next)) root.style.removeProperty(key);\n }\n ownedKeys.current = new Set(Object.keys(next));\n for (const [key, value] of Object.entries(next)) {\n root.style.setProperty(key, value);\n }\n };\n window.addEventListener(\"message\", handleMessage);\n return () => {\n window.removeEventListener(\"message\", handleMessage);\n };\n }, []);\n\n return null;\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,WAAW,cAAc;AAElC,SAAS,yCAAyC;AAE3C,SAAS,uBAAuB;AAGrC,QAAM,YAAY,OAA2B,IAAI;AAGjD,YAAU,MAAM;AACd,UAAM,gBAAgB,CAAC,UAAwB;AAC7C,YAAM,SAAS,kCAAkC,UAAU,MAAM,IAAI;AACrE,UAAI,CAAC,OAAO,QAAS;AACrB,YAAM,OAAO,OAAO,KAAK;AACzB,YAAM,OAAO,SAAS;AACtB,YAAM,QAAQ,UAAU,WAAW,oBAAI,IAAI;AAC3C,iBAAW,OAAO,OAAO;AACvB,YAAI,EAAE,OAAO,MAAO,MAAK,MAAM,eAAe,GAAG;AAAA,MACnD;AACA,gBAAU,UAAU,IAAI,IAAI,OAAO,KAAK,IAAI,CAAC;AAC7C,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,aAAK,MAAM,YAAY,KAAK,KAAK;AAAA,MACnC;AAAA,IACF;AACA,WAAO,iBAAiB,WAAW,aAAa;AAChD,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,aAAa;AAAA,IACrD;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { AnalyticsProvider } from "../analytics/analytics-provider";
|
|
3
3
|
import { CartLoader } from "../cart/cart-loader";
|
|
4
4
|
import { ClientErrorBoundary } from "../editor/ClientErrorBoundary";
|
|
5
|
+
import { DesignLibraryPreview } from "../editor/design-library-preview/DesignLibraryPreview";
|
|
5
6
|
import LinkInterceptor from "../editor/LinkInterceptor";
|
|
6
7
|
import PostHogRelay from "../editor/posthog-relay";
|
|
7
8
|
import { EditorSelection } from "../editor/select-mode/EditorSelection";
|
|
@@ -11,6 +12,7 @@ function ReploProvider({ children }) {
|
|
|
11
12
|
/* @__PURE__ */ jsx(LinkInterceptor, {}),
|
|
12
13
|
/* @__PURE__ */ jsx(PostHogRelay, {}),
|
|
13
14
|
/* @__PURE__ */ jsx(EditorSelection, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(DesignLibraryPreview, {}),
|
|
14
16
|
children
|
|
15
17
|
] }) }) }) });
|
|
16
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../providers/replo-provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <CartLoader>\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"../editor/design-library-preview/DesignLibraryPreview\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <CartLoader>\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
|
|
5
|
+
"mappings": "AAcU,SACE,KADF;AAdV,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,OAAO,qBAAqB;AAC5B,OAAO,kBAAkB;AACzB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAEvB,SAAS,cAAc,EAAE,SAAS,GAA4B;AACnE,SACE,oBAAC,iBACC,8BAAC,qBACC,8BAAC,cACC,+BAAC,uBACC;AAAA,wBAAC,mBAAgB;AAAA,IACjB,oBAAC,gBAAa;AAAA,IACd,oBAAC,mBAAgB;AAAA,IACjB,oBAAC,wBAAqB;AAAA,IACrB;AAAA,KACH,GACF,GACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|