@drawcall/design 0.12.3 → 0.12.5

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.
@@ -112,6 +112,7 @@ export declare const contract: {
112
112
  width: z.ZodNumber;
113
113
  height: z.ZodNumber;
114
114
  viewUrl: z.ZodString;
115
+ previewUrl: z.ZodString;
115
116
  createdAt: z.ZodString;
116
117
  updatedAt: z.ZodString;
117
118
  type: z.ZodLiteral<"glts">;
@@ -138,6 +139,7 @@ export declare const contract: {
138
139
  width: z.ZodNumber;
139
140
  height: z.ZodNumber;
140
141
  viewUrl: z.ZodString;
142
+ previewUrl: z.ZodString;
141
143
  createdAt: z.ZodString;
142
144
  updatedAt: z.ZodString;
143
145
  type: z.ZodLiteral<"markdown">;
@@ -151,6 +153,7 @@ export declare const contract: {
151
153
  width: z.ZodNumber;
152
154
  height: z.ZodNumber;
153
155
  viewUrl: z.ZodString;
156
+ previewUrl: z.ZodString;
154
157
  contentRevision: z.ZodOptional<z.ZodNumber>;
155
158
  createdAt: z.ZodString;
156
159
  updatedAt: z.ZodString;
@@ -188,6 +191,7 @@ export declare const contract: {
188
191
  width: z.ZodNumber;
189
192
  height: z.ZodNumber;
190
193
  viewUrl: z.ZodString;
194
+ previewUrl: z.ZodString;
191
195
  contentRevision: z.ZodOptional<z.ZodNumber>;
192
196
  createdAt: z.ZodString;
193
197
  updatedAt: z.ZodString;
@@ -202,6 +206,11 @@ export declare const contract: {
202
206
  type: z.ZodLiteral<"glts">;
203
207
  width: z.ZodNumber;
204
208
  height: z.ZodNumber;
209
+ text: z.ZodOptional<z.ZodString>;
210
+ imports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
211
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
212
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
213
+ }, z.core.$strict>>>;
205
214
  }, z.core.$strict>, z.ZodObject<{
206
215
  project: z.ZodString;
207
216
  name: z.ZodString;
@@ -210,6 +219,7 @@ export declare const contract: {
210
219
  type: z.ZodLiteral<"markdown">;
211
220
  width: z.ZodNumber;
212
221
  height: z.ZodNumber;
222
+ text: z.ZodOptional<z.ZodString>;
213
223
  }, z.core.$strict>, z.ZodObject<{
214
224
  project: z.ZodString;
215
225
  name: z.ZodString;
@@ -233,6 +243,7 @@ export declare const contract: {
233
243
  width: z.ZodNumber;
234
244
  height: z.ZodNumber;
235
245
  viewUrl: z.ZodString;
246
+ previewUrl: z.ZodString;
236
247
  createdAt: z.ZodString;
237
248
  updatedAt: z.ZodString;
238
249
  type: z.ZodLiteral<"glts">;
@@ -259,6 +270,7 @@ export declare const contract: {
259
270
  width: z.ZodNumber;
260
271
  height: z.ZodNumber;
261
272
  viewUrl: z.ZodString;
273
+ previewUrl: z.ZodString;
262
274
  createdAt: z.ZodString;
263
275
  updatedAt: z.ZodString;
264
276
  type: z.ZodLiteral<"markdown">;
@@ -272,6 +284,7 @@ export declare const contract: {
272
284
  width: z.ZodNumber;
273
285
  height: z.ZodNumber;
274
286
  viewUrl: z.ZodString;
287
+ previewUrl: z.ZodString;
275
288
  contentRevision: z.ZodOptional<z.ZodNumber>;
276
289
  createdAt: z.ZodString;
277
290
  updatedAt: z.ZodString;
@@ -309,6 +322,7 @@ export declare const contract: {
309
322
  width: z.ZodNumber;
310
323
  height: z.ZodNumber;
311
324
  viewUrl: z.ZodString;
325
+ previewUrl: z.ZodString;
312
326
  contentRevision: z.ZodOptional<z.ZodNumber>;
313
327
  createdAt: z.ZodString;
314
328
  updatedAt: z.ZodString;
@@ -353,6 +367,7 @@ export declare const contract: {
353
367
  width: z.ZodNumber;
354
368
  height: z.ZodNumber;
355
369
  viewUrl: z.ZodString;
370
+ previewUrl: z.ZodString;
356
371
  createdAt: z.ZodString;
357
372
  updatedAt: z.ZodString;
358
373
  type: z.ZodLiteral<"glts">;
@@ -379,6 +394,7 @@ export declare const contract: {
379
394
  width: z.ZodNumber;
380
395
  height: z.ZodNumber;
381
396
  viewUrl: z.ZodString;
397
+ previewUrl: z.ZodString;
382
398
  createdAt: z.ZodString;
383
399
  updatedAt: z.ZodString;
384
400
  type: z.ZodLiteral<"markdown">;
@@ -392,6 +408,7 @@ export declare const contract: {
392
408
  width: z.ZodNumber;
393
409
  height: z.ZodNumber;
394
410
  viewUrl: z.ZodString;
411
+ previewUrl: z.ZodString;
395
412
  contentRevision: z.ZodOptional<z.ZodNumber>;
396
413
  createdAt: z.ZodString;
397
414
  updatedAt: z.ZodString;
@@ -429,6 +446,7 @@ export declare const contract: {
429
446
  width: z.ZodNumber;
430
447
  height: z.ZodNumber;
431
448
  viewUrl: z.ZodString;
449
+ previewUrl: z.ZodString;
432
450
  contentRevision: z.ZodOptional<z.ZodNumber>;
433
451
  createdAt: z.ZodString;
434
452
  updatedAt: z.ZodString;
@@ -448,6 +466,7 @@ export declare const contract: {
448
466
  width: z.ZodNumber;
449
467
  height: z.ZodNumber;
450
468
  viewUrl: z.ZodString;
469
+ previewUrl: z.ZodString;
451
470
  createdAt: z.ZodString;
452
471
  updatedAt: z.ZodString;
453
472
  type: z.ZodLiteral<"glts">;
@@ -474,6 +493,7 @@ export declare const contract: {
474
493
  width: z.ZodNumber;
475
494
  height: z.ZodNumber;
476
495
  viewUrl: z.ZodString;
496
+ previewUrl: z.ZodString;
477
497
  createdAt: z.ZodString;
478
498
  updatedAt: z.ZodString;
479
499
  type: z.ZodLiteral<"markdown">;
@@ -487,6 +507,7 @@ export declare const contract: {
487
507
  width: z.ZodNumber;
488
508
  height: z.ZodNumber;
489
509
  viewUrl: z.ZodString;
510
+ previewUrl: z.ZodString;
490
511
  contentRevision: z.ZodOptional<z.ZodNumber>;
491
512
  createdAt: z.ZodString;
492
513
  updatedAt: z.ZodString;
@@ -524,6 +545,7 @@ export declare const contract: {
524
545
  width: z.ZodNumber;
525
546
  height: z.ZodNumber;
526
547
  viewUrl: z.ZodString;
548
+ previewUrl: z.ZodString;
527
549
  contentRevision: z.ZodOptional<z.ZodNumber>;
528
550
  createdAt: z.ZodString;
529
551
  updatedAt: z.ZodString;
@@ -557,6 +579,7 @@ export declare const contract: {
557
579
  width: z.ZodNumber;
558
580
  height: z.ZodNumber;
559
581
  viewUrl: z.ZodString;
582
+ previewUrl: z.ZodString;
560
583
  createdAt: z.ZodString;
561
584
  updatedAt: z.ZodString;
562
585
  type: z.ZodLiteral<"glts">;
@@ -583,6 +606,7 @@ export declare const contract: {
583
606
  width: z.ZodNumber;
584
607
  height: z.ZodNumber;
585
608
  viewUrl: z.ZodString;
609
+ previewUrl: z.ZodString;
586
610
  createdAt: z.ZodString;
587
611
  updatedAt: z.ZodString;
588
612
  type: z.ZodLiteral<"markdown">;
@@ -596,6 +620,7 @@ export declare const contract: {
596
620
  width: z.ZodNumber;
597
621
  height: z.ZodNumber;
598
622
  viewUrl: z.ZodString;
623
+ previewUrl: z.ZodString;
599
624
  contentRevision: z.ZodOptional<z.ZodNumber>;
600
625
  createdAt: z.ZodString;
601
626
  updatedAt: z.ZodString;
@@ -633,6 +658,7 @@ export declare const contract: {
633
658
  width: z.ZodNumber;
634
659
  height: z.ZodNumber;
635
660
  viewUrl: z.ZodString;
661
+ previewUrl: z.ZodString;
636
662
  contentRevision: z.ZodOptional<z.ZodNumber>;
637
663
  createdAt: z.ZodString;
638
664
  updatedAt: z.ZodString;
@@ -655,6 +681,7 @@ export declare const contract: {
655
681
  width: z.ZodNumber;
656
682
  height: z.ZodNumber;
657
683
  viewUrl: z.ZodString;
684
+ previewUrl: z.ZodString;
658
685
  createdAt: z.ZodString;
659
686
  updatedAt: z.ZodString;
660
687
  type: z.ZodLiteral<"glts">;
@@ -681,6 +708,7 @@ export declare const contract: {
681
708
  width: z.ZodNumber;
682
709
  height: z.ZodNumber;
683
710
  viewUrl: z.ZodString;
711
+ previewUrl: z.ZodString;
684
712
  createdAt: z.ZodString;
685
713
  updatedAt: z.ZodString;
686
714
  type: z.ZodLiteral<"markdown">;
@@ -694,6 +722,7 @@ export declare const contract: {
694
722
  width: z.ZodNumber;
695
723
  height: z.ZodNumber;
696
724
  viewUrl: z.ZodString;
725
+ previewUrl: z.ZodString;
697
726
  contentRevision: z.ZodOptional<z.ZodNumber>;
698
727
  createdAt: z.ZodString;
699
728
  updatedAt: z.ZodString;
@@ -731,6 +760,7 @@ export declare const contract: {
731
760
  width: z.ZodNumber;
732
761
  height: z.ZodNumber;
733
762
  viewUrl: z.ZodString;
763
+ previewUrl: z.ZodString;
734
764
  contentRevision: z.ZodOptional<z.ZodNumber>;
735
765
  createdAt: z.ZodString;
736
766
  updatedAt: z.ZodString;
@@ -1109,6 +1139,10 @@ export declare const contract: {
1109
1139
  project: z.ZodString;
1110
1140
  path: z.ZodString;
1111
1141
  text: z.ZodString;
1142
+ imports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1143
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1144
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1145
+ }, z.core.$strict>>>;
1112
1146
  }, z.core.$strip>, z.ZodObject<{
1113
1147
  paths: z.ZodArray<z.ZodString>;
1114
1148
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -1117,6 +1151,10 @@ export declare const contract: {
1117
1151
  path: z.ZodString;
1118
1152
  oldText: z.ZodString;
1119
1153
  newText: z.ZodString;
1154
+ imports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1155
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1156
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1157
+ }, z.core.$strict>>>;
1120
1158
  }, z.core.$strip>, z.ZodObject<{
1121
1159
  paths: z.ZodArray<z.ZodString>;
1122
1160
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -1,7 +1,7 @@
1
1
  import { oc } from "@orpc/contract";
2
2
  import { z } from "zod";
3
3
  import { projectFrameLayoutSchema } from "../project-state.js";
4
- import { cameraPoseSchema, commentBodySchema, commentSchema, createFrameSchema, createCommentSchema, createProjectFromBriefSchema, designIdSchema, fileListSchema, fileMutationSchema, fileSchema, fileTextSchema, frameExportSchema, frameNameSchema, frameSchema, generateImageSchema, projectDirectoryPathSchema, projectFilePathSchema, projectNameSchema, projectSchema, screenshotSchema, userSchema, } from "./schemas.js";
4
+ import { cameraPoseSchema, commentBodySchema, commentSchema, createFrameSchema, createCommentSchema, createProjectFromBriefSchema, designIdSchema, fileListSchema, fileMutationSchema, fileSchema, fileTextSchema, importsSchema, frameExportSchema, frameNameSchema, frameSchema, generateImageSchema, projectDirectoryPathSchema, projectFilePathSchema, projectNameSchema, projectSchema, screenshotSchema, userSchema, } from "./schemas.js";
5
5
  const projectInputSchema = z.object({ project: designIdSchema });
6
6
  const frameInputSchema = projectInputSchema.extend({ frame: designIdSchema });
7
7
  const commentInputSchema = projectInputSchema.extend({
@@ -151,13 +151,17 @@ export const contract = {
151
151
  .output(fileSchema),
152
152
  write: oc
153
153
  .route({ method: "PUT", path: "/projects/{project}/files/{path}" })
154
- .input(fileInputSchema.extend({ text: fileTextSchema }))
154
+ .input(fileInputSchema.extend({
155
+ text: fileTextSchema,
156
+ imports: importsSchema.optional(),
157
+ }))
155
158
  .output(fileMutationSchema),
156
159
  edit: oc
157
160
  .route({ method: "PATCH", path: "/projects/{project}/files/{path}" })
158
161
  .input(fileInputSchema.extend({
159
162
  oldText: fileTextSchema.min(1),
160
163
  newText: fileTextSchema,
164
+ imports: importsSchema.optional(),
161
165
  }))
162
166
  .output(fileMutationSchema),
163
167
  delete: oc
@@ -39,6 +39,18 @@ export declare const projectPathSchema: z.ZodString;
39
39
  export declare const projectDirectoryPathSchema: z.ZodUnion<readonly [z.ZodLiteral<"/">, z.ZodString]>;
40
40
  export declare const projectFilePathSchema: z.ZodString;
41
41
  export declare const fileTextSchema: z.ZodString;
42
+ /** The space a not-yet-written GLTS file will occupy, as its placeholder box. */
43
+ export declare const boundingBoxSchema: z.ZodObject<{
44
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
45
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
46
+ }, z.core.$strict>;
47
+ /** A static `.glts` import specifier as written in source: relative or project-absolute. */
48
+ export declare const importSpecifierSchema: z.ZodString;
49
+ /** Bounding boxes for imported `.glts` files that do not exist yet, keyed by specifier. */
50
+ export declare const importsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
51
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
52
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
53
+ }, z.core.$strict>>;
42
54
  export declare const marketAssetNameSchema: z.ZodString;
43
55
  export declare const marketAssetVersionSchema: z.ZodString;
44
56
  export declare const marketAssetSchema: z.ZodString;
@@ -189,6 +201,7 @@ export declare const gltsFrameSchema: z.ZodObject<{
189
201
  width: z.ZodNumber;
190
202
  height: z.ZodNumber;
191
203
  viewUrl: z.ZodString;
204
+ previewUrl: z.ZodString;
192
205
  createdAt: z.ZodString;
193
206
  updatedAt: z.ZodString;
194
207
  type: z.ZodLiteral<"glts">;
@@ -216,6 +229,7 @@ export declare const markdownFrameSchema: z.ZodObject<{
216
229
  width: z.ZodNumber;
217
230
  height: z.ZodNumber;
218
231
  viewUrl: z.ZodString;
232
+ previewUrl: z.ZodString;
219
233
  createdAt: z.ZodString;
220
234
  updatedAt: z.ZodString;
221
235
  type: z.ZodLiteral<"markdown">;
@@ -272,6 +286,7 @@ export declare const imageFrameSchema: z.ZodObject<{
272
286
  width: z.ZodNumber;
273
287
  height: z.ZodNumber;
274
288
  viewUrl: z.ZodString;
289
+ previewUrl: z.ZodString;
275
290
  contentRevision: z.ZodOptional<z.ZodNumber>;
276
291
  createdAt: z.ZodString;
277
292
  updatedAt: z.ZodString;
@@ -310,6 +325,7 @@ export declare const marketFrameSchema: z.ZodObject<{
310
325
  width: z.ZodNumber;
311
326
  height: z.ZodNumber;
312
327
  viewUrl: z.ZodString;
328
+ previewUrl: z.ZodString;
313
329
  contentRevision: z.ZodOptional<z.ZodNumber>;
314
330
  createdAt: z.ZodString;
315
331
  updatedAt: z.ZodString;
@@ -325,6 +341,7 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
325
341
  width: z.ZodNumber;
326
342
  height: z.ZodNumber;
327
343
  viewUrl: z.ZodString;
344
+ previewUrl: z.ZodString;
328
345
  createdAt: z.ZodString;
329
346
  updatedAt: z.ZodString;
330
347
  type: z.ZodLiteral<"glts">;
@@ -351,6 +368,7 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
351
368
  width: z.ZodNumber;
352
369
  height: z.ZodNumber;
353
370
  viewUrl: z.ZodString;
371
+ previewUrl: z.ZodString;
354
372
  createdAt: z.ZodString;
355
373
  updatedAt: z.ZodString;
356
374
  type: z.ZodLiteral<"markdown">;
@@ -364,6 +382,7 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
364
382
  width: z.ZodNumber;
365
383
  height: z.ZodNumber;
366
384
  viewUrl: z.ZodString;
385
+ previewUrl: z.ZodString;
367
386
  contentRevision: z.ZodOptional<z.ZodNumber>;
368
387
  createdAt: z.ZodString;
369
388
  updatedAt: z.ZodString;
@@ -401,6 +420,7 @@ export declare const frameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
401
420
  width: z.ZodNumber;
402
421
  height: z.ZodNumber;
403
422
  viewUrl: z.ZodString;
423
+ previewUrl: z.ZodString;
404
424
  contentRevision: z.ZodOptional<z.ZodNumber>;
405
425
  createdAt: z.ZodString;
406
426
  updatedAt: z.ZodString;
@@ -415,6 +435,11 @@ export declare const createGltsFrameSchema: z.ZodObject<{
415
435
  type: z.ZodLiteral<"glts">;
416
436
  width: z.ZodNumber;
417
437
  height: z.ZodNumber;
438
+ text: z.ZodOptional<z.ZodString>;
439
+ imports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
440
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
441
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
442
+ }, z.core.$strict>>>;
418
443
  }, z.core.$strict>;
419
444
  export declare const createMarkdownFrameSchema: z.ZodObject<{
420
445
  project: z.ZodString;
@@ -424,6 +449,7 @@ export declare const createMarkdownFrameSchema: z.ZodObject<{
424
449
  type: z.ZodLiteral<"markdown">;
425
450
  width: z.ZodNumber;
426
451
  height: z.ZodNumber;
452
+ text: z.ZodOptional<z.ZodString>;
427
453
  }, z.core.$strict>;
428
454
  export declare const createImageFrameSchema: z.ZodObject<{
429
455
  project: z.ZodString;
@@ -449,6 +475,11 @@ export declare const createFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
449
475
  type: z.ZodLiteral<"glts">;
450
476
  width: z.ZodNumber;
451
477
  height: z.ZodNumber;
478
+ text: z.ZodOptional<z.ZodString>;
479
+ imports: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
480
+ min: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
481
+ max: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
482
+ }, z.core.$strict>>>;
452
483
  }, z.core.$strict>, z.ZodObject<{
453
484
  project: z.ZodString;
454
485
  name: z.ZodString;
@@ -457,6 +488,7 @@ export declare const createFrameSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
457
488
  type: z.ZodLiteral<"markdown">;
458
489
  width: z.ZodNumber;
459
490
  height: z.ZodNumber;
491
+ text: z.ZodOptional<z.ZodString>;
460
492
  }, z.core.$strict>, z.ZodObject<{
461
493
  project: z.ZodString;
462
494
  name: z.ZodString;
@@ -728,6 +760,8 @@ export type TextFile = z.infer<typeof textFileSchema>;
728
760
  export type BinaryFile = z.infer<typeof binaryFileSchema>;
729
761
  export type DesignFile = z.infer<typeof fileSchema>;
730
762
  export type FileMutation = z.infer<typeof fileMutationSchema>;
763
+ export type BoundingBox = z.infer<typeof boundingBoxSchema>;
764
+ export type Imports = z.infer<typeof importsSchema>;
731
765
  export type Screenshot = z.infer<typeof screenshotSchema>;
732
766
  export type GltsFrameExport = z.infer<typeof gltsFrameExportSchema>;
733
767
  export type MarkdownFrameExport = z.infer<typeof markdownFrameExportSchema>;
@@ -77,6 +77,29 @@ export const projectFilePathSchema = projectPathSchema
77
77
  .regex(/^\/[a-z0-9]{14}\/.+/, "Project file paths must include a frame ID and filename, for example /a4z8m2q7v9kcde/index.glts")
78
78
  .describe("Project-absolute file path including the frame ID, for example /a4z8m2q7v9kcde/index.glts");
79
79
  export const fileTextSchema = z.string().max(MAX_FILE_LENGTH);
80
+ const coordinateSchema = z.number().finite();
81
+ const cornerSchema = z.tuple([
82
+ coordinateSchema,
83
+ coordinateSchema,
84
+ coordinateSchema,
85
+ ]);
86
+ /** The space a not-yet-written GLTS file will occupy, as its placeholder box. */
87
+ export const boundingBoxSchema = z
88
+ .object({ min: cornerSchema, max: cornerSchema })
89
+ .strict()
90
+ .refine((box) => box.min[0] <= box.max[0] &&
91
+ box.min[1] <= box.max[1] &&
92
+ box.min[2] <= box.max[2], {
93
+ message: "min must not exceed max on any axis",
94
+ });
95
+ /** A static `.glts` import specifier as written in source: relative or project-absolute. */
96
+ export const importSpecifierSchema = z
97
+ .string()
98
+ .min(1)
99
+ .max(1024)
100
+ .regex(/^(\.\.?\/|\/).*\.glts$/, "Import specifiers are relative or project-absolute .glts paths");
101
+ /** Bounding boxes for imported `.glts` files that do not exist yet, keyed by specifier. */
102
+ export const importsSchema = z.record(importSpecifierSchema, boundingBoxSchema);
80
103
  export const marketAssetNameSchema = z
81
104
  .string()
82
105
  .min(1)
@@ -200,6 +223,7 @@ const frameBaseSchema = z.object({
200
223
  width: frameSizeSchema,
201
224
  height: frameSizeSchema,
202
225
  viewUrl: httpUrlSchema,
226
+ previewUrl: httpUrlSchema,
203
227
  contentRevision: z.number().int().nonnegative().optional(),
204
228
  createdAt: z.string().datetime(),
205
229
  updatedAt: z.string().datetime(),
@@ -280,6 +304,9 @@ export const createGltsFrameSchema = createFrameBaseSchema
280
304
  type: z.literal("glts"),
281
305
  width: frameSizeSchema,
282
306
  height: frameSizeSchema,
307
+ /** Initial `index.glts` source, stored with the frame in one operation. */
308
+ text: fileTextSchema.optional(),
309
+ imports: importsSchema.optional(),
283
310
  })
284
311
  .strict();
285
312
  export const createMarkdownFrameSchema = createFrameBaseSchema
@@ -287,6 +314,8 @@ export const createMarkdownFrameSchema = createFrameBaseSchema
287
314
  type: z.literal("markdown"),
288
315
  width: frameSizeSchema,
289
316
  height: frameSizeSchema,
317
+ /** Initial `index.md` source, stored with the frame in one operation. */
318
+ text: fileTextSchema.optional(),
290
319
  })
291
320
  .strict();
292
321
  export const createImageFrameSchema = createFrameBaseSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawcall/design",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "description": "Typed API and remote CLI for Drawcall Design",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,6 +16,28 @@ Select the project with `-p <project-id>`. File commands take project-absolute p
16
16
  ```sh
17
17
  npx drawcall design project list
18
18
  npx drawcall design -p r6z2n9k4x8m1qc frame list
19
+ npx drawcall design -p r6z2n9k4x8m1qc frame create Racecar --type glts --size 1280x800 --import ./parts/wheel.glts=-0.5,0,-0.5:0.5,1,0.5 --text - <<'GLTS'
20
+ import * as THREE from "three";
21
+ import Wheel from "./parts/wheel.glts";
22
+
23
+ export default class Racecar extends THREE.Group {
24
+ constructor() {
25
+ super();
26
+ this.add(new Wheel());
27
+ }
28
+ }
29
+ GLTS
30
+ npx drawcall design -p r6z2n9k4x8m1qc write /a4z8m2q7v9kcde/parts/wheel.glts - <<'GLTS'
31
+ import * as THREE from "three";
32
+
33
+ export default class Wheel extends THREE.Mesh {
34
+ constructor() {
35
+ super(new THREE.TorusGeometry(0.4, 0.12, 16, 48), new THREE.MeshStandardMaterial({ color: 0x222222 }));
36
+ }
37
+ }
38
+ GLTS
39
+ npx drawcall design -p r6z2n9k4x8m1qc frame preview a4z8m2q7v9kcde
40
+ npx drawcall design -p r6z2n9k4x8m1qc frame screenshot a4z8m2q7v9kcde
19
41
  npx drawcall design -p r6z2n9k4x8m1qc ls
20
42
  npx drawcall design -p r6z2n9k4x8m1qc read /a4z8m2q7v9kcde/index.glts
21
43
  npx drawcall design -p r6z2n9k4x8m1qc edit /a4z8m2q7v9kcde/index.glts 'color: 0xffffff' 'color: 0x000000'
@@ -29,7 +51,7 @@ npx drawcall design -p r6z2n9k4x8m1qc frame generate-image 'Product photograph'
29
51
  npx drawcall design -p r6z2n9k4x8m1qc frame edit-image b4z8m2q7v9kcdf --prompt 'Use warmer light' --name 'Warm product photograph' --reference ./lighting.webp
30
52
  ```
31
53
 
32
- Comment create and reply text is positional to keep commands compact. Omit it or pass `-` to read the text from stdin. Use `--position-2d x,y` only for normalized image coordinates and `--position-3d x,y,z` only for authoritative GLTS world coordinates.
54
+ `frame create --text`, `write`, comment create, and reply text accept `-` to read the text from stdin; a quoted heredoc keeps multi-line source intact. `--import <specifier>=<min>:<max>` declares the bounding box of an imported `.glts` file that does not exist yet, as `x,y,z:x,y,z`, and may repeat. Run one file write per command invocation, never several in one shell command. Use `--position-2d x,y` only for normalized image coordinates and `--position-3d x,y,z` only for authoritative GLTS world coordinates.
33
55
 
34
56
  Design is a remote, current-state canvas. Inspect the project and its frames before changing them. Use immutable IDs for every project and frame target; names are mutable labels. In user-facing replies, refer to projects, frames, and other named resources by their current names. Do not expose their IDs unless the user explicitly asks for them; IDs may remain embedded in URLs that link to those resources.
35
57
 
@@ -39,13 +61,13 @@ We recommend using Drawcall Market when a design needs 3D assets such as models,
39
61
 
40
62
  A project is a hosted filesystem at `https://<project-id>.design.drawcallcontent.com/`. Each frame owns one top-level directory, `/<frame-id>`. Files use project-absolute paths that include that directory, for example `/a4z8m2q7v9kcde/index.glts`.
41
63
 
42
- Create frames with an explicit type. Choose the type from the requested artifact, not from the word "frame": use GLTS for a 3D object or scene, Markdown for a formatted text document, image for an existing 2D image, and Market only for an exact public asset reference, `name@version`. GLTS and Markdown frames require a viewport size; image and Market frames derive their canvas size.
64
+ Create frames with an explicit type. Choose the type from the requested artifact, not from the word "frame": use GLTS for a 3D object or scene, Markdown for a formatted text document, image for an existing 2D image, and Market only for an exact public asset reference, `name@version`. GLTS and Markdown frames require a viewport size; image and Market frames derive their canvas size. A GLTS or Markdown frame accepts its root file at creation.
43
65
 
44
66
  Read a file before editing it. Use a narrow edit for one known change and write a complete file when replacing it. GLTS and Markdown frame files may be created or deleted. Image and Market frame files are read-only.
45
67
 
46
- ## Frame images
68
+ ## Frame previews
47
69
 
48
- Every frame has a public image at `https://<project-id>.design.drawcallcontent.com/<frame-id>.webp`. This URL represents the current rendered frame whether its type is GLTS, Markdown, image, or Market. Pass it with `--reference` when one frame's appearance should inform another image. A reference may instead be a local PNG, JPEG, or WebP file.
70
+ Every frame has a canonical public WebP preview in `previewUrl` at `https://<project-id>.design.drawcallcontent.com/<frame-id>.webp`, whether its type is GLTS, Markdown, image, or Market. `frame preview <frame-id>` prints that URL. Use `frame screenshot` only when a fresh PNG render is required. Pass a preview URL with `--reference` when one frame's appearance should inform another image. A reference may instead be a local PNG, JPEG, or WebP file.
49
71
 
50
72
  ## Markdown documents
51
73
 
@@ -75,16 +97,27 @@ An error means the requested operation did not happen. Follow its next action wi
75
97
 
76
98
  A GLTS frame contains only `.glts` files. `index.glts` is its optional root asset; without it the frame renders empty. Every `.glts` file is a trusted TypeScript ESM module that default-exports a no-argument class derived from `THREE.Object3D`. Avoid top-level side effects because reload evaluates the module again. Implement `dispose()` when the asset exclusively owns disposable resources.
77
99
 
78
- Author GLTS scenes top-down: create the root entry scene first, reference the child `.glts` assets it will compose, then implement those children progressively. A missing `.glts` import renders as a glowing marker labeled with its filename until the real file is written, so the completed parts of the scene remain visible. Treat the marker and its console warning as a temporary missing-dependency diagnostic, not as authored content.
100
+ For a 3D object, create the frame with its complete `index.glts` first, giving each imported `.glts` file that does not exist yet a rough bounding box in `imports`, then write the imported files one call at a time, the most visible first, and take a screenshot once they all exist. This order shows the whole object early and keeps every write visible. A file that imports further files declares their boxes the same way.
79
101
 
80
102
  ```ts
81
103
  import * as THREE from "three";
104
+ import Chassis from "./parts/chassis.glts";
82
105
  import Wheel from "./parts/wheel.glts";
83
106
 
84
107
  export default class Racecar extends THREE.Group {
85
108
  constructor() {
86
109
  super();
87
- this.add(new Wheel());
110
+ this.add(new Chassis());
111
+ for (const [x, z] of [
112
+ [-0.8, 1.3],
113
+ [0.8, 1.3],
114
+ [-0.8, -1.3],
115
+ [0.8, -1.3],
116
+ ]) {
117
+ const wheel = new Wheel();
118
+ wheel.position.set(x, 0.4, z);
119
+ this.add(wheel);
120
+ }
88
121
  }
89
122
  }
90
123
  ```