@webstudio-is/sdk 0.271.0 → 0.273.0

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/lib/schema.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // src/schema/assets.ts
2
2
  import { z } from "zod";
3
- import { FontFormat, FontMeta } from "@webstudio-is/fonts";
4
- var AssetId = z.string();
3
+ import { fontFormat, fontMeta } from "@webstudio-is/fonts";
4
+ var assetId = z.string();
5
5
  var baseAsset = {
6
- id: AssetId,
6
+ id: assetId,
7
7
  projectId: z.string(),
8
8
  size: z.number(),
9
9
  name: z.string(),
@@ -11,36 +11,37 @@ var baseAsset = {
11
11
  description: z.union([z.string().optional(), z.null()]),
12
12
  createdAt: z.string()
13
13
  };
14
- var FontAsset = z.object({
14
+ var assetType = z.enum(["font", "image", "file"]);
15
+ var fontAsset = z.object({
15
16
  ...baseAsset,
16
- format: FontFormat,
17
- meta: FontMeta,
18
- type: z.literal("font")
17
+ format: fontFormat,
18
+ meta: fontMeta,
19
+ type: z.literal(assetType.enum.font)
19
20
  });
20
- var ImageMeta = z.object({
21
+ var imageMeta = z.object({
21
22
  width: z.number(),
22
23
  height: z.number()
23
24
  });
24
- var ImageAsset = z.object({
25
+ var imageAsset = z.object({
25
26
  ...baseAsset,
26
27
  format: z.string(),
27
- meta: ImageMeta,
28
- type: z.literal("image")
28
+ meta: imageMeta,
29
+ type: z.literal(assetType.enum.image)
29
30
  });
30
- var FileAsset = z.object({
31
+ var fileAsset = z.object({
31
32
  ...baseAsset,
32
33
  format: z.string(),
33
34
  meta: z.object({}),
34
- type: z.literal("file")
35
+ type: z.literal(assetType.enum.file)
35
36
  });
36
- var Asset = z.union([FontAsset, ImageAsset, FileAsset]);
37
- var Assets = z.map(AssetId, Asset);
37
+ var asset = z.union([fontAsset, imageAsset, fileAsset]);
38
+ var assets = z.map(assetId, asset);
38
39
 
39
40
  // src/schema/breakpoints.ts
40
41
  import { z as z2 } from "zod";
41
- var BreakpointId = z2.string();
42
- var Breakpoint = z2.object({
43
- id: BreakpointId,
42
+ var breakpointId = z2.string();
43
+ var breakpoint = z2.object({
44
+ id: breakpointId,
44
45
  label: z2.string(),
45
46
  minWidth: z2.number().optional(),
46
47
  maxWidth: z2.number().optional(),
@@ -59,7 +60,7 @@ var Breakpoint = z2.object({
59
60
  }
60
61
  return true;
61
62
  }, "Width-based (minWidth/maxWidth) and condition are mutually exclusive, and minWidth must be less than maxWidth");
62
- var Breakpoints = z2.map(BreakpointId, Breakpoint);
63
+ var breakpoints = z2.map(breakpointId, breakpoint);
63
64
  var initialBreakpoints = [
64
65
  { id: "placeholder", label: "Base" },
65
66
  { id: "placeholder", label: "Tablet", maxWidth: 991 },
@@ -69,8 +70,8 @@ var initialBreakpoints = [
69
70
 
70
71
  // src/schema/data-sources.ts
71
72
  import { z as z3 } from "zod";
72
- var DataSourceId = z3.string();
73
- var DataSourceVariableValue = z3.union([
73
+ var dataSourceId = z3.string();
74
+ var dataSourceVariableValue = z3.union([
74
75
  z3.object({
75
76
  type: z3.literal("number"),
76
77
  // initial value of variable store
@@ -93,10 +94,10 @@ var DataSourceVariableValue = z3.union([
93
94
  value: z3.unknown()
94
95
  })
95
96
  ]);
96
- var DataSource = z3.union([
97
+ var dataSource = z3.union([
97
98
  z3.object({
98
99
  type: z3.literal("variable"),
99
- id: DataSourceId,
100
+ id: dataSourceId,
100
101
  // The instance should always be specified for variables,
101
102
  // however, there was a bug in the embed template
102
103
  // which produced variables without an instance
@@ -104,27 +105,27 @@ var DataSource = z3.union([
104
105
  // if we make it required
105
106
  scopeInstanceId: z3.string().optional(),
106
107
  name: z3.string(),
107
- value: DataSourceVariableValue
108
+ value: dataSourceVariableValue
108
109
  }),
109
110
  z3.object({
110
111
  type: z3.literal("parameter"),
111
- id: DataSourceId,
112
+ id: dataSourceId,
112
113
  scopeInstanceId: z3.string().optional(),
113
114
  name: z3.string()
114
115
  }),
115
116
  z3.object({
116
117
  type: z3.literal("resource"),
117
- id: DataSourceId,
118
+ id: dataSourceId,
118
119
  scopeInstanceId: z3.string().optional(),
119
120
  name: z3.string(),
120
121
  resourceId: z3.string()
121
122
  })
122
123
  ]);
123
- var DataSources = z3.map(DataSourceId, DataSource);
124
+ var dataSources = z3.map(dataSourceId, dataSource);
124
125
 
125
126
  // src/schema/deployment.ts
126
127
  import { z as z4 } from "zod";
127
- var Templates = z4.enum([
128
+ var templates = z4.enum([
128
129
  "docker",
129
130
  "vercel",
130
131
  "netlify",
@@ -132,13 +133,13 @@ var Templates = z4.enum([
132
133
  "ssg-netlify",
133
134
  "ssg-vercel"
134
135
  ]);
135
- var Deployment = z4.union([
136
+ var deployment = z4.union([
136
137
  z4.object({
137
138
  destination: z4.literal("static"),
138
139
  name: z4.string(),
139
140
  assetsDomain: z4.string(),
140
141
  // Must be validated very strictly
141
- templates: z4.array(Templates)
142
+ templates: z4.array(templates)
142
143
  }),
143
144
  z4.object({
144
145
  destination: z4.literal("saas").optional(),
@@ -154,55 +155,55 @@ var Deployment = z4.union([
154
155
 
155
156
  // src/schema/instances.ts
156
157
  import { z as z5 } from "zod";
157
- var TextChild = z5.object({
158
+ var textChild = z5.object({
158
159
  type: z5.literal("text"),
159
160
  value: z5.string(),
160
161
  placeholder: z5.boolean().optional()
161
162
  });
162
- var InstanceId = z5.string();
163
- var IdChild = z5.object({
163
+ var instanceId = z5.string();
164
+ var idChild = z5.object({
164
165
  type: z5.literal("id"),
165
- value: InstanceId
166
+ value: instanceId
166
167
  });
167
- var ExpressionChild = z5.object({
168
+ var expressionChild = z5.object({
168
169
  type: z5.literal("expression"),
169
170
  value: z5.string()
170
171
  });
171
- var InstanceChild = z5.union([IdChild, TextChild, ExpressionChild]);
172
- var Instance = z5.object({
172
+ var instanceChild = z5.union([idChild, textChild, expressionChild]);
173
+ var instance = z5.object({
173
174
  type: z5.literal("instance"),
174
- id: InstanceId,
175
+ id: instanceId,
175
176
  component: z5.string(),
176
177
  tag: z5.string().optional(),
177
178
  label: z5.string().optional(),
178
- children: z5.array(InstanceChild)
179
+ children: z5.array(instanceChild)
179
180
  });
180
- var Instances = z5.map(InstanceId, Instance);
181
+ var instances = z5.map(instanceId, instance);
181
182
 
182
183
  // src/schema/pages.ts
183
184
  import { z as z6 } from "zod";
184
185
  import { validateBasicAuth } from "@webstudio-is/wsauth";
185
186
  var MIN_TITLE_LENGTH = 2;
186
- var PageId = z6.string();
187
- var FolderId = z6.string();
188
- var FolderName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
189
- var Slug = z6.string().refine(
187
+ var pageId = z6.string();
188
+ var folderId = z6.string();
189
+ var folderName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
190
+ var slug = z6.string().refine(
190
191
  (path) => /^[-a-z0-9]*$/.test(path),
191
192
  "Only a-z, 0-9 and - are allowed"
192
193
  );
193
- var Folder = z6.object({
194
- id: FolderId,
195
- name: FolderName,
196
- slug: Slug,
197
- children: z6.array(z6.union([FolderId, PageId]))
194
+ var folder = z6.object({
195
+ id: folderId,
196
+ name: folderName,
197
+ slug,
198
+ children: z6.array(z6.union([folderId, pageId]))
198
199
  });
199
- var PageName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
200
- var PageTitle = z6.string().refine(
200
+ var pageName = z6.string().refine((value) => value.trim() !== "", "Can't be empty");
201
+ var pageTitle = z6.string().refine(
201
202
  (val) => val.length >= MIN_TITLE_LENGTH,
202
203
  `Minimum ${MIN_TITLE_LENGTH} characters required`
203
204
  );
204
205
  var documentTypes = ["html", "xml", "text"];
205
- var BasicAuthFields = {
206
+ var basicAuthFields = {
206
207
  login: z6.string(),
207
208
  password: z6.string()
208
209
  };
@@ -218,23 +219,23 @@ var validateBasicAuthFields = ({
218
219
  });
219
220
  }
220
221
  };
221
- var PageBasicAuth = z6.object({
222
+ var pageBasicAuth = z6.object({
222
223
  method: z6.literal("basic"),
223
- ...BasicAuthFields
224
+ ...basicAuthFields
224
225
  }).superRefine(validateBasicAuthFields);
225
- var LegacyPageBasicAuth = z6.object({
226
+ var legacyPageBasicAuth = z6.object({
226
227
  type: z6.literal("basic"),
227
- ...BasicAuthFields
228
+ ...basicAuthFields
228
229
  }).superRefine(validateBasicAuthFields).transform(({ login, password }) => ({
229
230
  method: "basic",
230
231
  login,
231
232
  password
232
233
  }));
233
- var PageAuth = z6.union([PageBasicAuth, LegacyPageBasicAuth]);
234
+ var pageAuth = z6.union([pageBasicAuth, legacyPageBasicAuth]);
234
235
  var commonPageFields = {
235
- id: PageId,
236
- name: PageName,
237
- title: PageTitle,
236
+ id: pageId,
237
+ name: pageName,
238
+ title: pageTitle,
238
239
  history: z6.optional(z6.array(z6.string())),
239
240
  rootInstanceId: z6.string(),
240
241
  systemDataSourceId: z6.string().optional(),
@@ -249,7 +250,7 @@ var commonPageFields = {
249
250
  redirect: z6.string().optional(),
250
251
  documentType: z6.optional(z6.enum(documentTypes)),
251
252
  content: z6.string().optional(),
252
- auth: PageAuth.optional(),
253
+ auth: pageAuth.optional(),
253
254
  custom: z6.array(
254
255
  z6.object({
255
256
  property: z6.string(),
@@ -265,8 +266,8 @@ var commonPageFields = {
265
266
  })
266
267
  )
267
268
  };
268
- var HomePagePath = z6.string().refine((path) => path === "", "Home page path must be empty");
269
- var DefaultPagePage = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
269
+ var homePagePath = z6.string().refine((path) => path === "", "Home page path must be empty");
270
+ var defaultPagePath = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine((path) => path.endsWith("/") === false, "Can't end with a /").refine((path) => path.includes("//") === false, "Can't contain repeating /").refine(
270
271
  (path) => /^[-_a-z0-9*:?\\/.]*$/.test(path),
271
272
  "Only a-z, 0-9, -, _, /, :, ?, . and * are allowed"
272
273
  ).refine(
@@ -279,7 +280,7 @@ var DefaultPagePage = z6.string().refine((path) => path !== "", "Can't be empty"
279
280
  (path) => path !== "/build" && path.startsWith("/build/") === false,
280
281
  "/build prefix is reserved for the system"
281
282
  ).refine((path) => path.length <= 255, "Path can't exceed 255 characters");
282
- var RedirectSourcePath = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine(
283
+ var redirectSourcePath = z6.string().refine((path) => path !== "", "Can't be empty").refine((path) => path !== "/", "Can't be just a /").refine(
283
284
  (path) => path.startsWith("/") && path.startsWith("//") === false,
284
285
  "Must start with a /"
285
286
  ).refine((path) => {
@@ -299,23 +300,23 @@ var RedirectSourcePath = z6.string().refine((path) => path !== "", "Can't be emp
299
300
  (path) => path !== "/build" && path.startsWith("/build/") === false,
300
301
  "/build prefix is reserved for the system"
301
302
  );
302
- var PagePath = DefaultPagePage.refine(
303
+ var pagePath = defaultPagePath.refine(
303
304
  (path) => path === "" || path.startsWith("/"),
304
305
  "Must start with a / or a full URL e.g. https://website.org"
305
306
  );
306
- var Page = z6.object({
307
+ var page = z6.object({
307
308
  ...commonPageFields,
308
- path: z6.union([HomePagePath, PagePath])
309
+ path: z6.union([homePagePath, pagePath])
309
310
  });
310
- var PageTemplate = z6.object({
311
- id: PageId,
312
- name: PageName,
313
- title: PageTitle,
311
+ var pageTemplate = z6.object({
312
+ id: pageId,
313
+ name: pageName,
314
+ title: pageTitle,
314
315
  rootInstanceId: z6.string(),
315
316
  systemDataSourceId: z6.string().optional(),
316
317
  meta: commonPageFields.meta
317
318
  });
318
- var ProjectMeta = z6.object({
319
+ var projectMeta = z6.object({
319
320
  // All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
320
321
  siteName: z6.string().optional(),
321
322
  contactEmail: z6.string().optional(),
@@ -323,7 +324,7 @@ var ProjectMeta = z6.object({
323
324
  code: z6.string().optional(),
324
325
  auth: z6.string().optional()
325
326
  });
326
- var ProjectNewRedirectPath = z6.string().min(1, "Path is required").refine((data) => {
327
+ var projectNewRedirectPath = z6.string().min(1, "Path is required").refine((data) => {
327
328
  try {
328
329
  new URL(data, "http://url.com");
329
330
  return true;
@@ -331,27 +332,27 @@ var ProjectNewRedirectPath = z6.string().min(1, "Path is required").refine((data
331
332
  return false;
332
333
  }
333
334
  }, "Must be a valid URL");
334
- var PageRedirect = z6.object({
335
- old: RedirectSourcePath,
336
- new: ProjectNewRedirectPath,
335
+ var pageRedirect = z6.object({
336
+ old: redirectSourcePath,
337
+ new: projectNewRedirectPath,
337
338
  status: z6.enum(["301", "302"]).optional()
338
339
  });
339
- var CompilerSettings = z6.object({
340
+ var compilerSettings = z6.object({
340
341
  // All fields are optional to ensure consistency and allow for the addition of new fields without requiring migration
341
342
  atomicStyles: z6.boolean().optional()
342
343
  });
343
- var Pages = z6.object({
344
- meta: ProjectMeta.optional(),
345
- compiler: CompilerSettings.optional(),
346
- redirects: z6.array(PageRedirect).optional(),
347
- homePageId: PageId,
348
- rootFolderId: FolderId,
349
- pages: z6.map(PageId, Page),
350
- pageTemplates: z6.map(PageId, PageTemplate).optional(),
351
- folders: z6.map(FolderId, Folder).refine((folders) => folders.size > 0, "Folders can't be empty")
352
- }).superRefine((pages, context) => {
353
- const homePage = pages.pages.get(pages.homePageId);
354
- const rootFolder = pages.folders.get(pages.rootFolderId);
344
+ var pages = z6.object({
345
+ meta: projectMeta.optional(),
346
+ compiler: compilerSettings.optional(),
347
+ redirects: z6.array(pageRedirect).optional(),
348
+ homePageId: pageId,
349
+ rootFolderId: folderId,
350
+ pages: z6.map(pageId, page),
351
+ pageTemplates: z6.map(pageId, pageTemplate).optional(),
352
+ folders: z6.map(folderId, folder).refine((folders) => folders.size > 0, "Folders can't be empty")
353
+ }).superRefine((pages2, context) => {
354
+ const homePage = pages2.pages.get(pages2.homePageId);
355
+ const rootFolder = pages2.folders.get(pages2.rootFolderId);
355
356
  if (homePage === void 0) {
356
357
  context.addIssue({
357
358
  code: z6.ZodIssueCode.custom,
@@ -369,27 +370,27 @@ var Pages = z6.object({
369
370
  if (homePage !== void 0 && homePage.path !== "") {
370
371
  context.addIssue({
371
372
  code: z6.ZodIssueCode.custom,
372
- path: ["pages", pages.homePageId, "path"],
373
+ path: ["pages", pages2.homePageId, "path"],
373
374
  message: "Home page path must be empty"
374
375
  });
375
376
  }
376
- for (const [pageId, page] of pages.pages) {
377
- if (page.id !== pageId) {
377
+ for (const [pageId2, page2] of pages2.pages) {
378
+ if (page2.id !== pageId2) {
378
379
  context.addIssue({
379
380
  code: z6.ZodIssueCode.custom,
380
- path: ["pages", pageId, "id"],
381
+ path: ["pages", pageId2, "id"],
381
382
  message: "Page id must match its record key"
382
383
  });
383
384
  }
384
- if (pageId !== pages.homePageId && page.path === "") {
385
+ if (pageId2 !== pages2.homePageId && page2.path === "") {
385
386
  context.addIssue({
386
387
  code: z6.ZodIssueCode.custom,
387
- path: ["pages", pageId, "path"],
388
+ path: ["pages", pageId2, "path"],
388
389
  message: "Page path can't be empty"
389
390
  });
390
391
  }
391
392
  }
392
- for (const [templateId, template] of pages.pageTemplates ?? []) {
393
+ for (const [templateId, template] of pages2.pageTemplates ?? []) {
393
394
  if (template.id !== templateId) {
394
395
  context.addIssue({
395
396
  code: z6.ZodIssueCode.custom,
@@ -397,7 +398,7 @@ var Pages = z6.object({
397
398
  message: "Page template id must match its record key"
398
399
  });
399
400
  }
400
- if (pages.pages.has(templateId)) {
401
+ if (pages2.pages.has(templateId)) {
401
402
  context.addIssue({
402
403
  code: z6.ZodIssueCode.custom,
403
404
  path: ["pageTemplates", templateId, "id"],
@@ -405,75 +406,75 @@ var Pages = z6.object({
405
406
  });
406
407
  }
407
408
  }
408
- for (const [folderId, folder] of pages.folders) {
409
- if (folder.id !== folderId) {
409
+ for (const [folderId2, folder2] of pages2.folders) {
410
+ if (folder2.id !== folderId2) {
410
411
  context.addIssue({
411
412
  code: z6.ZodIssueCode.custom,
412
- path: ["folders", folderId, "id"],
413
+ path: ["folders", folderId2, "id"],
413
414
  message: "Folder id must match its record key"
414
415
  });
415
416
  }
416
- for (const [index, childId] of folder.children.entries()) {
417
- if (pages.pages.has(childId) === false && pages.folders.has(childId) === false) {
417
+ for (const [index, childId] of folder2.children.entries()) {
418
+ if (pages2.pages.has(childId) === false && pages2.folders.has(childId) === false) {
418
419
  context.addIssue({
419
420
  code: z6.ZodIssueCode.custom,
420
- path: ["folders", folderId, "children", index],
421
+ path: ["folders", folderId2, "children", index],
421
422
  message: "Folder child must reference an existing page or folder"
422
423
  });
423
424
  }
424
- if (childId === pages.rootFolderId) {
425
+ if (childId === pages2.rootFolderId) {
425
426
  context.addIssue({
426
427
  code: z6.ZodIssueCode.custom,
427
- path: ["folders", folderId, "children", index],
428
+ path: ["folders", folderId2, "children", index],
428
429
  message: "Root folder can't be nested"
429
430
  });
430
431
  }
431
432
  }
432
433
  }
433
- if (rootFolder !== void 0 && rootFolder.children[0] !== pages.homePageId) {
434
+ if (rootFolder !== void 0 && rootFolder.children[0] !== pages2.homePageId) {
434
435
  context.addIssue({
435
436
  code: z6.ZodIssueCode.custom,
436
- path: ["folders", pages.rootFolderId, "children"],
437
+ path: ["folders", pages2.rootFolderId, "children"],
437
438
  message: "Root folder must start with the home page"
438
439
  });
439
440
  }
440
441
  const childParents = /* @__PURE__ */ new Map();
441
- for (const [folderId, folder] of pages.folders) {
442
- for (const [index, childId] of folder.children.entries()) {
442
+ for (const [folderId2, folder2] of pages2.folders) {
443
+ for (const [index, childId] of folder2.children.entries()) {
443
444
  const parentId = childParents.get(childId);
444
445
  if (parentId !== void 0) {
445
446
  context.addIssue({
446
447
  code: z6.ZodIssueCode.custom,
447
- path: ["folders", folderId, "children", index],
448
+ path: ["folders", folderId2, "children", index],
448
449
  message: `Child is already registered in folder "${parentId}"`
449
450
  });
450
451
  continue;
451
452
  }
452
- childParents.set(childId, folderId);
453
+ childParents.set(childId, folderId2);
453
454
  }
454
455
  }
455
- const hasFolderCycle = (folderId, path = /* @__PURE__ */ new Set()) => {
456
- if (path.has(folderId)) {
456
+ const hasFolderCycle = (folderId2, path = /* @__PURE__ */ new Set()) => {
457
+ if (path.has(folderId2)) {
457
458
  return true;
458
459
  }
459
- const folder = pages.folders.get(folderId);
460
- if (folder === void 0) {
460
+ const folder2 = pages2.folders.get(folderId2);
461
+ if (folder2 === void 0) {
461
462
  return false;
462
463
  }
463
- path.add(folderId);
464
- for (const childId of folder.children) {
465
- if (pages.folders.has(childId) && hasFolderCycle(childId, path)) {
464
+ path.add(folderId2);
465
+ for (const childId of folder2.children) {
466
+ if (pages2.folders.has(childId) && hasFolderCycle(childId, path)) {
466
467
  return true;
467
468
  }
468
469
  }
469
- path.delete(folderId);
470
+ path.delete(folderId2);
470
471
  return false;
471
472
  };
472
- for (const folderId of pages.folders.keys()) {
473
- if (hasFolderCycle(folderId)) {
473
+ for (const folderId2 of pages2.folders.keys()) {
474
+ if (hasFolderCycle(folderId2)) {
474
475
  context.addIssue({
475
476
  code: z6.ZodIssueCode.custom,
476
- path: ["folders", folderId, "children"],
477
+ path: ["folders", folderId2, "children"],
477
478
  message: "Folders can't contain cycles"
478
479
  });
479
480
  }
@@ -484,7 +485,7 @@ var Pages = z6.object({
484
485
  import { z as z8 } from "zod";
485
486
 
486
487
  // src/schema/animation-schema.ts
487
- import { StyleValue } from "@webstudio-is/css-engine";
488
+ import { styleValue } from "@webstudio-is/css-engine";
488
489
  import { z as z7 } from "zod";
489
490
  var literalUnion = (arr) => z7.union(
490
491
  arr.map((val) => z7.literal(val))
@@ -533,12 +534,12 @@ var RANGE_UNITS = [
533
534
  "lvmax",
534
535
  "dvmax"
535
536
  ];
536
- var rangeUnitSchema = literalUnion(RANGE_UNITS);
537
- var rangeUnitValueSchema = z7.union([
537
+ var rangeUnit = literalUnion(RANGE_UNITS);
538
+ var rangeUnitValue = z7.union([
538
539
  z7.object({
539
540
  type: z7.literal("unit"),
540
541
  value: z7.number(),
541
- unit: rangeUnitSchema
542
+ unit: rangeUnit
542
543
  }),
543
544
  z7.object({
544
545
  type: z7.literal("unparsed"),
@@ -550,32 +551,32 @@ var rangeUnitValueSchema = z7.union([
550
551
  })
551
552
  ]);
552
553
  var TIME_UNITS = ["ms", "s"];
553
- var timeUnitSchema = literalUnion(TIME_UNITS);
554
- var durationUnitValueSchema = z7.union([
554
+ var timeUnit = literalUnion(TIME_UNITS);
555
+ var durationUnitValue = z7.union([
555
556
  z7.object({
556
557
  type: z7.literal("unit"),
557
558
  value: z7.number(),
558
- unit: timeUnitSchema
559
+ unit: timeUnit
559
560
  }),
560
561
  z7.object({
561
562
  type: z7.literal("var"),
562
563
  value: z7.string()
563
564
  })
564
565
  ]);
565
- var iterationsUnitValueSchema = z7.union([z7.number(), z7.literal("infinite")]);
566
- var insetUnitValueSchema = z7.union([
567
- rangeUnitValueSchema,
566
+ var iterationsUnitValue = z7.union([z7.number(), z7.literal("infinite")]);
567
+ var insetUnitValue = z7.union([
568
+ rangeUnitValue,
568
569
  z7.object({
569
570
  type: z7.literal("keyword"),
570
571
  value: z7.literal("auto")
571
572
  })
572
573
  ]);
573
- var keyframeStylesSchema = z7.record(StyleValue);
574
- var animationKeyframeSchema = z7.object({
574
+ var keyframeStyles = z7.record(styleValue);
575
+ var animationKeyframe = z7.object({
575
576
  offset: z7.number().optional(),
576
- styles: keyframeStylesSchema
577
+ styles: keyframeStyles
577
578
  });
578
- var keyframeEffectOptionsSchema = z7.object({
579
+ var keyframeEffectOptions = z7.object({
579
580
  easing: z7.string().optional(),
580
581
  fill: z7.union([
581
582
  z7.literal("none"),
@@ -584,29 +585,23 @@ var keyframeEffectOptionsSchema = z7.object({
584
585
  z7.literal("both")
585
586
  ]).optional(),
586
587
  // FillMode
587
- duration: durationUnitValueSchema.optional(),
588
- delay: durationUnitValueSchema.optional(),
589
- iterations: iterationsUnitValueSchema.optional()
588
+ duration: durationUnitValue.optional(),
589
+ delay: durationUnitValue.optional(),
590
+ iterations: iterationsUnitValue.optional()
590
591
  });
591
- var scrollNamedRangeSchema = z7.union([
592
- z7.literal("start"),
593
- z7.literal("end")
594
- ]);
595
- var scrollRangeValueSchema = z7.tuple([
596
- scrollNamedRangeSchema,
597
- rangeUnitValueSchema
598
- ]);
599
- var scrollRangeOptionsSchema = z7.object({
600
- rangeStart: scrollRangeValueSchema.optional(),
601
- rangeEnd: scrollRangeValueSchema.optional()
592
+ var scrollNamedRange = z7.union([z7.literal("start"), z7.literal("end")]);
593
+ var scrollRangeValue = z7.tuple([scrollNamedRange, rangeUnitValue]);
594
+ var scrollRangeOptions = z7.object({
595
+ rangeStart: scrollRangeValue.optional(),
596
+ rangeEnd: scrollRangeValue.optional()
602
597
  });
603
- var animationAxisSchema = z7.union([
598
+ var animationAxis = z7.union([
604
599
  z7.literal("block"),
605
600
  z7.literal("inline"),
606
601
  z7.literal("x"),
607
602
  z7.literal("y")
608
603
  ]);
609
- var viewNamedRangeSchema = z7.union([
604
+ var viewNamedRange = z7.union([
610
605
  z7.literal("contain"),
611
606
  z7.literal("cover"),
612
607
  z7.literal("entry"),
@@ -614,62 +609,59 @@ var viewNamedRangeSchema = z7.union([
614
609
  z7.literal("entry-crossing"),
615
610
  z7.literal("exit-crossing")
616
611
  ]);
617
- var viewRangeValueSchema = z7.tuple([
618
- viewNamedRangeSchema,
619
- rangeUnitValueSchema
620
- ]);
621
- var viewRangeOptionsSchema = z7.object({
622
- rangeStart: viewRangeValueSchema.optional(),
623
- rangeEnd: viewRangeValueSchema.optional()
612
+ var viewRangeValue = z7.tuple([viewNamedRange, rangeUnitValue]);
613
+ var viewRangeOptions = z7.object({
614
+ rangeStart: viewRangeValue.optional(),
615
+ rangeEnd: viewRangeValue.optional()
624
616
  });
625
617
  var baseAnimation = z7.object({
626
618
  name: z7.string().optional(),
627
619
  description: z7.string().optional(),
628
620
  enabled: z7.array(z7.tuple([z7.string().describe("breakpointId"), z7.boolean()])).optional(),
629
- keyframes: z7.array(animationKeyframeSchema)
621
+ keyframes: z7.array(animationKeyframe)
630
622
  });
631
- var scrollAnimationSchema = baseAnimation.merge(
623
+ var scrollAnimation = baseAnimation.merge(
632
624
  z7.object({
633
- timing: keyframeEffectOptionsSchema.merge(scrollRangeOptionsSchema)
625
+ timing: keyframeEffectOptions.merge(scrollRangeOptions)
634
626
  })
635
627
  );
636
- var scrollActionSchema = z7.object({
628
+ var scrollAction = z7.object({
637
629
  type: z7.literal("scroll"),
638
630
  source: z7.union([z7.literal("closest"), z7.literal("nearest"), z7.literal("root")]).optional(),
639
- axis: animationAxisSchema.optional(),
640
- animations: z7.array(scrollAnimationSchema),
631
+ axis: animationAxis.optional(),
632
+ animations: z7.array(scrollAnimation),
641
633
  isPinned: z7.boolean().optional(),
642
634
  debug: z7.boolean().optional()
643
635
  });
644
- var viewAnimationSchema = baseAnimation.merge(
636
+ var viewAnimation = baseAnimation.merge(
645
637
  z7.object({
646
- timing: keyframeEffectOptionsSchema.merge(viewRangeOptionsSchema)
638
+ timing: keyframeEffectOptions.merge(viewRangeOptions)
647
639
  })
648
640
  );
649
- var viewActionSchema = z7.object({
641
+ var viewAction = z7.object({
650
642
  type: z7.literal("view"),
651
643
  subject: z7.string().optional(),
652
- axis: animationAxisSchema.optional(),
653
- animations: z7.array(viewAnimationSchema),
654
- insetStart: insetUnitValueSchema.optional(),
655
- insetEnd: insetUnitValueSchema.optional(),
644
+ axis: animationAxis.optional(),
645
+ animations: z7.array(viewAnimation),
646
+ insetStart: insetUnitValue.optional(),
647
+ insetEnd: insetUnitValue.optional(),
656
648
  isPinned: z7.boolean().optional(),
657
649
  debug: z7.boolean().optional()
658
650
  });
659
- var animationActionSchema = z7.discriminatedUnion("type", [
660
- scrollActionSchema,
661
- viewActionSchema
651
+ var animationAction = z7.discriminatedUnion("type", [
652
+ scrollAction,
653
+ viewAction
662
654
  ]);
663
655
 
664
656
  // src/schema/props.ts
665
- var PropId = z8.string();
657
+ var propId = z8.string();
666
658
  var baseProp = {
667
- id: PropId,
659
+ id: propId,
668
660
  instanceId: z8.string(),
669
661
  name: z8.string(),
670
662
  required: z8.optional(z8.boolean())
671
663
  };
672
- var Prop = z8.union([
664
+ var prop = z8.union([
673
665
  z8.object({
674
666
  ...baseProp,
675
667
  type: z8.literal("number"),
@@ -745,25 +737,25 @@ var Prop = z8.union([
745
737
  z8.object({
746
738
  ...baseProp,
747
739
  type: z8.literal("animationAction"),
748
- value: animationActionSchema
740
+ value: animationAction
749
741
  })
750
742
  ]);
751
- var Props = z8.map(PropId, Prop);
743
+ var props = z8.map(propId, prop);
752
744
 
753
745
  // src/schema/resources.ts
754
746
  import { z as z9 } from "zod";
755
- var ResourceId = z9.string();
756
- var Method = z9.union([
747
+ var resourceId = z9.string();
748
+ var method = z9.union([
757
749
  z9.literal("get"),
758
750
  z9.literal("post"),
759
751
  z9.literal("put"),
760
752
  z9.literal("delete")
761
753
  ]);
762
- var Resource = z9.object({
763
- id: ResourceId,
754
+ var resource = z9.object({
755
+ id: resourceId,
764
756
  name: z9.string(),
765
757
  control: z9.optional(z9.union([z9.literal("system"), z9.literal("graphql")])),
766
- method: Method,
758
+ method,
767
759
  // expression
768
760
  url: z9.string(),
769
761
  searchParams: z9.array(
@@ -783,9 +775,9 @@ var Resource = z9.object({
783
775
  // expression
784
776
  body: z9.optional(z9.string())
785
777
  });
786
- var ResourceRequest = z9.object({
778
+ var resourceRequest = z9.object({
787
779
  name: z9.string(),
788
- method: Method,
780
+ method,
789
781
  url: z9.string(),
790
782
  searchParams: z9.array(
791
783
  z9.object({
@@ -803,100 +795,101 @@ var ResourceRequest = z9.object({
803
795
  ),
804
796
  body: z9.optional(z9.unknown())
805
797
  });
806
- var Resources = z9.map(ResourceId, Resource);
798
+ var resources = z9.map(resourceId, resource);
807
799
 
808
800
  // src/schema/style-source-selections.ts
809
801
  import { z as z10 } from "zod";
810
- var InstanceId2 = z10.string();
811
- var StyleSourceId = z10.string();
812
- var StyleSourceSelection = z10.object({
813
- instanceId: InstanceId2,
814
- values: z10.array(StyleSourceId)
802
+ var instanceId2 = z10.string();
803
+ var styleSourceId = z10.string();
804
+ var styleSourceSelection = z10.object({
805
+ instanceId: instanceId2,
806
+ values: z10.array(styleSourceId)
815
807
  });
816
- var StyleSourceSelections = z10.map(InstanceId2, StyleSourceSelection);
808
+ var styleSourceSelections = z10.map(instanceId2, styleSourceSelection);
817
809
 
818
810
  // src/schema/style-sources.ts
819
811
  import { z as z11 } from "zod";
820
- var StyleSourceId2 = z11.string();
821
- var StyleSourceToken = z11.object({
812
+ var styleSourceId2 = z11.string();
813
+ var styleSourceToken = z11.object({
822
814
  type: z11.literal("token"),
823
- id: StyleSourceId2,
815
+ id: styleSourceId2,
824
816
  name: z11.string(),
825
817
  locked: z11.boolean().optional()
826
818
  });
827
- var StyleSourceLocal = z11.object({
819
+ var styleSourceLocal = z11.object({
828
820
  type: z11.literal("local"),
829
- id: StyleSourceId2
821
+ id: styleSourceId2
830
822
  });
831
- var StyleSource = z11.union([StyleSourceToken, StyleSourceLocal]);
832
- var StyleSources = z11.map(StyleSourceId2, StyleSource);
823
+ var styleSource = z11.union([styleSourceToken, styleSourceLocal]);
824
+ var styleSources = z11.map(styleSourceId2, styleSource);
833
825
 
834
826
  // src/schema/styles.ts
835
827
  import { z as z12 } from "zod";
836
- import { StyleValue as StyleValue2 } from "@webstudio-is/css-engine";
837
- var StyleDeclRaw = z12.object({
828
+ import { styleValue as styleValue2 } from "@webstudio-is/css-engine";
829
+ var styleDeclRaw = z12.object({
838
830
  styleSourceId: z12.string(),
839
831
  breakpointId: z12.string(),
840
832
  state: z12.optional(z12.string()),
841
833
  // @todo can't figure out how to make property to be enum
842
834
  property: z12.string(),
843
- value: StyleValue2,
835
+ value: styleValue2,
844
836
  listed: z12.boolean().optional().describe("Whether the style is from the Advanced panel")
845
837
  });
846
- var StyleDecl = StyleDeclRaw;
847
- var getStyleDeclKey = (styleDecl) => {
848
- return `${styleDecl.styleSourceId}:${styleDecl.breakpointId}:${styleDecl.property}:${styleDecl.state ?? ""}`;
838
+ var styleDecl = styleDeclRaw;
839
+ var getStyleDeclKey = (styleDecl2) => {
840
+ return `${styleDecl2.styleSourceId}:${styleDecl2.breakpointId}:${styleDecl2.property}:${styleDecl2.state ?? ""}`;
849
841
  };
850
- var Styles = z12.map(z12.string(), StyleDecl);
842
+ var styles = z12.map(z12.string(), styleDecl);
851
843
  export {
852
- Asset,
853
- Assets,
854
- Breakpoint,
855
- Breakpoints,
856
- CompilerSettings,
857
- DataSource,
858
- DataSourceVariableValue,
859
- DataSources,
860
- Deployment,
861
- ExpressionChild,
862
- FileAsset,
863
- Folder,
864
- FolderId,
865
- FolderName,
866
- FontAsset,
867
- HomePagePath,
868
- IdChild,
869
- ImageAsset,
870
- ImageMeta,
871
- Instance,
872
- InstanceChild,
873
- Instances,
874
- Page,
875
- PageAuth,
876
- PageId,
877
- PageName,
878
- PagePath,
879
- PageRedirect,
880
- PageTemplate,
881
- PageTitle,
882
- Pages,
883
- ProjectMeta,
884
- ProjectNewRedirectPath,
885
- Prop,
886
- Props,
887
- RedirectSourcePath,
888
- Resource,
889
- ResourceRequest,
890
- Resources,
891
- StyleDecl,
892
- StyleSource,
893
- StyleSourceSelection,
894
- StyleSourceSelections,
895
- StyleSources,
896
- Styles,
897
- Templates,
898
- TextChild,
844
+ asset,
845
+ assetType,
846
+ assets,
847
+ breakpoint,
848
+ breakpoints,
849
+ compilerSettings,
850
+ dataSource,
851
+ dataSourceVariableValue,
852
+ dataSources,
853
+ deployment,
899
854
  documentTypes,
855
+ expressionChild,
856
+ fileAsset,
857
+ folder,
858
+ folderId,
859
+ folderName,
860
+ fontAsset,
900
861
  getStyleDeclKey,
901
- initialBreakpoints
862
+ homePagePath,
863
+ idChild,
864
+ imageAsset,
865
+ imageMeta,
866
+ initialBreakpoints,
867
+ instance,
868
+ instanceChild,
869
+ instances,
870
+ page,
871
+ pageAuth,
872
+ pageId,
873
+ pageName,
874
+ pagePath,
875
+ pageRedirect,
876
+ pageTemplate,
877
+ pageTitle,
878
+ pages,
879
+ projectMeta,
880
+ projectNewRedirectPath,
881
+ prop,
882
+ props,
883
+ redirectSourcePath,
884
+ resource,
885
+ resourceRequest,
886
+ resources,
887
+ styleDecl,
888
+ styleSource,
889
+ styleSourceSelection,
890
+ styleSourceSelections,
891
+ styleSources,
892
+ styles,
893
+ templates,
894
+ textChild
902
895
  };