@enhance-eng/enhance 0.1.33 → 0.1.37
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/dist/{cli-output-identity.lib-CWNAXho4.mjs → cli-output-identity.lib-i4KnVAYs.mjs} +1209 -680
- package/dist/main.mjs +392 -50
- package/dist/{mcp-invocation.adapter-DHdF8-MP.mjs → mcp-invocation.adapter-CBnzmPZl.mjs} +8 -4
- package/dist/mcp-main.mjs +7 -7
- package/dist/{mcp-server.adapter-B0Kn0e7m.mjs → mcp-server.adapter-DC9gAePw.mjs} +2 -1
- package/dist/mcp.mjs +2 -2
- package/dist/{mutation-key.adapter-A1d27TVY.mjs → mutation-key.adapter-Ck8nOqke.mjs} +57 -22
- package/dist/remote-mcp-main.mjs +5 -5
- package/package.json +3 -7
|
@@ -51,7 +51,7 @@ const BYTES_PER_KIB$1 = 1024;
|
|
|
51
51
|
//#region ../../packages/contract/src/canvas/canvas-thumbnail.schema.ts
|
|
52
52
|
const THUMBNAIL_WIDTH = 528;
|
|
53
53
|
const THUMBNAIL_HEIGHT = 312;
|
|
54
|
-
/** @justified
|
|
54
|
+
/** @justified warning Lossless PNG needs more headroom than client JPEG/WebP. */
|
|
55
55
|
const THUMBNAIL_MAX_KIB = 1024;
|
|
56
56
|
const MAX_RELEASE_IDENTITY_LENGTH = 100;
|
|
57
57
|
const MAX_THUMBNAIL_BYTES = THUMBNAIL_MAX_KIB * BYTES_PER_KIB$1;
|
|
@@ -95,17 +95,23 @@ const reportCanvasThumbnailUnavailableOutputSchema = z.object({ recorded: z.lite
|
|
|
95
95
|
const CANVAS_ACCESS_STATES = [
|
|
96
96
|
"invite-only",
|
|
97
97
|
"link-view",
|
|
98
|
-
"link-comment"
|
|
98
|
+
"link-comment",
|
|
99
|
+
"link-edit"
|
|
99
100
|
];
|
|
100
101
|
const canvasAccessStateSchema = z.enum(CANVAS_ACCESS_STATES);
|
|
101
102
|
const ACCESS_LEVELS = [
|
|
102
103
|
"owner",
|
|
104
|
+
"can-edit",
|
|
103
105
|
"can-comment",
|
|
104
106
|
"can-view"
|
|
105
107
|
];
|
|
106
108
|
const accessLevelSchema = z.enum(ACCESS_LEVELS);
|
|
107
|
-
/**
|
|
108
|
-
const grantableAccessLevelSchema = z.enum([
|
|
109
|
+
/** An invitation grants content access, never ownership. Only the creator is an owner, and only by creating. */
|
|
110
|
+
const grantableAccessLevelSchema = z.enum([
|
|
111
|
+
"can-edit",
|
|
112
|
+
"can-comment",
|
|
113
|
+
"can-view"
|
|
114
|
+
]);
|
|
109
115
|
/** What this viewer may do here, resolved server-side so the UI never has to guess. */
|
|
110
116
|
const viewerCapabilitySchema = z.object({
|
|
111
117
|
read: z.boolean(),
|
|
@@ -114,6 +120,20 @@ const viewerCapabilitySchema = z.object({
|
|
|
114
120
|
"sign-in",
|
|
115
121
|
"no"
|
|
116
122
|
]),
|
|
123
|
+
edit: z.enum([
|
|
124
|
+
"yes",
|
|
125
|
+
"sign-in",
|
|
126
|
+
"no"
|
|
127
|
+
]).default("no"),
|
|
128
|
+
grants: z.array(z.object({
|
|
129
|
+
source: z.enum([
|
|
130
|
+
"direct",
|
|
131
|
+
"team",
|
|
132
|
+
"link"
|
|
133
|
+
]),
|
|
134
|
+
accessLevel: accessLevelSchema
|
|
135
|
+
})).default([]),
|
|
136
|
+
grantableAccessLevels: z.array(grantableAccessLevelSchema).default([]),
|
|
117
137
|
share: z.boolean(),
|
|
118
138
|
manage: z.boolean()
|
|
119
139
|
});
|
|
@@ -209,11 +229,182 @@ const markCanvasViewedOutputSchema = z.object({ lastViewedAt: z.iso.datetime().n
|
|
|
209
229
|
const restoreCanvasInputSchema = z.object({ canvasId: z.uuid() });
|
|
210
230
|
const restoreCanvasOutputSchema = z.object({ canvasId: z.uuid() });
|
|
211
231
|
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region ../../packages/contract/src/canvas/canvas-css-value.schema.ts
|
|
234
|
+
const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
|
|
235
|
+
const canvasCssValueSchema = z.string().refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
|
|
236
|
+
|
|
212
237
|
//#endregion
|
|
213
238
|
//#region ../../packages/contract/src/canvas/canvas-limits.schema.ts
|
|
214
239
|
const canvasNumberSchema = z.number();
|
|
215
240
|
const nonNegativeCanvasNumberSchema = z.number().nonnegative();
|
|
216
241
|
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region ../../packages/contract/src/canvas/canvas-paint.schema.ts
|
|
244
|
+
const QUARTER_TURN = 90;
|
|
245
|
+
const HALF_TURN = 180;
|
|
246
|
+
const THREE_QUARTER_TURN = 270;
|
|
247
|
+
const boundedNumber$1 = canvasNumberSchema;
|
|
248
|
+
const nonNegativeNumber$2 = nonNegativeCanvasNumberSchema;
|
|
249
|
+
const ratio$1 = z.number().min(0).max(1);
|
|
250
|
+
const itemId$1 = z.string().min(1);
|
|
251
|
+
const canvasColorSchema = z.object({
|
|
252
|
+
space: z.enum(["srgb", "display-p3"]),
|
|
253
|
+
red: ratio$1,
|
|
254
|
+
green: ratio$1,
|
|
255
|
+
blue: ratio$1,
|
|
256
|
+
alpha: ratio$1,
|
|
257
|
+
definitionId: itemId$1.optional()
|
|
258
|
+
});
|
|
259
|
+
const canvasGradientStopSchema = z.object({
|
|
260
|
+
id: itemId$1,
|
|
261
|
+
position: ratio$1,
|
|
262
|
+
color: canvasColorSchema
|
|
263
|
+
});
|
|
264
|
+
const adjustment = z.number().min(-1).max(1);
|
|
265
|
+
const canvasImageAdjustmentsSchema = z.object({
|
|
266
|
+
exposure: adjustment.optional(),
|
|
267
|
+
contrast: adjustment.optional(),
|
|
268
|
+
saturation: adjustment.optional(),
|
|
269
|
+
temperature: adjustment.optional(),
|
|
270
|
+
tint: adjustment.optional(),
|
|
271
|
+
highlights: adjustment.optional(),
|
|
272
|
+
shadows: adjustment.optional()
|
|
273
|
+
});
|
|
274
|
+
/** Maps normalized source (u,v) into body (a*u+c*v+e,b*u+d*v+f), before node rotation. */
|
|
275
|
+
const canvasPaintTransformSchema = z.tuple([
|
|
276
|
+
boundedNumber$1,
|
|
277
|
+
boundedNumber$1,
|
|
278
|
+
boundedNumber$1,
|
|
279
|
+
boundedNumber$1,
|
|
280
|
+
boundedNumber$1,
|
|
281
|
+
boundedNumber$1
|
|
282
|
+
]).refine(([a, b, c, d]) => a * d !== b * c, "paint transform must be invertible");
|
|
283
|
+
const CANVAS_BLEND_MODES = [
|
|
284
|
+
"normal",
|
|
285
|
+
"multiply",
|
|
286
|
+
"screen",
|
|
287
|
+
"overlay",
|
|
288
|
+
"darken",
|
|
289
|
+
"lighten",
|
|
290
|
+
"plus-lighter",
|
|
291
|
+
"color-dodge",
|
|
292
|
+
"color-burn",
|
|
293
|
+
"hard-light",
|
|
294
|
+
"soft-light",
|
|
295
|
+
"difference",
|
|
296
|
+
"exclusion",
|
|
297
|
+
"hue",
|
|
298
|
+
"saturation",
|
|
299
|
+
"color",
|
|
300
|
+
"luminosity"
|
|
301
|
+
];
|
|
302
|
+
const canvasBlendModeSchema = z.enum(CANVAS_BLEND_MODES);
|
|
303
|
+
const canvasBlendSourceSchema = z.object({
|
|
304
|
+
kind: z.literal("figma"),
|
|
305
|
+
originalMode: z.string(),
|
|
306
|
+
mappedMode: canvasBlendModeSchema,
|
|
307
|
+
sourceGuid: z.string().optional(),
|
|
308
|
+
path: z.array(z.string())
|
|
309
|
+
});
|
|
310
|
+
const canvasPaintBaseSchema = z.object({
|
|
311
|
+
id: itemId$1,
|
|
312
|
+
blendMode: canvasBlendModeSchema.optional(),
|
|
313
|
+
blendSource: canvasBlendSourceSchema.optional(),
|
|
314
|
+
visible: z.boolean(),
|
|
315
|
+
opacity: ratio$1
|
|
316
|
+
});
|
|
317
|
+
const canvasPaintCoreSchema = z.discriminatedUnion("kind", [
|
|
318
|
+
canvasPaintBaseSchema.extend({
|
|
319
|
+
kind: z.literal("solid"),
|
|
320
|
+
color: canvasColorSchema
|
|
321
|
+
}),
|
|
322
|
+
canvasPaintBaseSchema.extend({
|
|
323
|
+
kind: z.literal("linear-gradient"),
|
|
324
|
+
angle: boundedNumber$1,
|
|
325
|
+
transform: canvasPaintTransformSchema.optional(),
|
|
326
|
+
stops: z.array(canvasGradientStopSchema).min(2)
|
|
327
|
+
}),
|
|
328
|
+
canvasPaintBaseSchema.extend({
|
|
329
|
+
kind: z.literal("radial-gradient"),
|
|
330
|
+
center: z.object({
|
|
331
|
+
x: boundedNumber$1,
|
|
332
|
+
y: boundedNumber$1
|
|
333
|
+
}),
|
|
334
|
+
radius: z.object({
|
|
335
|
+
x: nonNegativeNumber$2,
|
|
336
|
+
y: nonNegativeNumber$2
|
|
337
|
+
}),
|
|
338
|
+
transform: canvasPaintTransformSchema.optional(),
|
|
339
|
+
stops: z.array(canvasGradientStopSchema).min(2)
|
|
340
|
+
}),
|
|
341
|
+
canvasPaintBaseSchema.extend({
|
|
342
|
+
kind: z.literal("angular-gradient"),
|
|
343
|
+
/** Maps normalized gradient coordinates into the node body, before node rotation. */
|
|
344
|
+
transform: canvasPaintTransformSchema,
|
|
345
|
+
stops: z.array(canvasGradientStopSchema).min(2)
|
|
346
|
+
}),
|
|
347
|
+
canvasPaintBaseSchema.extend({
|
|
348
|
+
kind: z.literal("diamond-gradient"),
|
|
349
|
+
transform: canvasPaintTransformSchema,
|
|
350
|
+
stops: z.array(canvasGradientStopSchema).min(2)
|
|
351
|
+
}),
|
|
352
|
+
canvasPaintBaseSchema.extend({
|
|
353
|
+
kind: z.literal("image"),
|
|
354
|
+
assetId: z.string().min(1),
|
|
355
|
+
fit: z.enum([
|
|
356
|
+
"fill",
|
|
357
|
+
"cover",
|
|
358
|
+
"fit",
|
|
359
|
+
"crop",
|
|
360
|
+
"tile"
|
|
361
|
+
]),
|
|
362
|
+
tileScale: boundedNumber$1.positive().optional(),
|
|
363
|
+
tileOrigin: z.enum(["center", "top-left"]).optional(),
|
|
364
|
+
rotation: z.union([
|
|
365
|
+
z.literal(0),
|
|
366
|
+
z.literal(QUARTER_TURN),
|
|
367
|
+
z.literal(HALF_TURN),
|
|
368
|
+
z.literal(THREE_QUARTER_TURN)
|
|
369
|
+
]).optional(),
|
|
370
|
+
crop: z.object({
|
|
371
|
+
x: ratio$1,
|
|
372
|
+
y: ratio$1,
|
|
373
|
+
width: ratio$1,
|
|
374
|
+
height: ratio$1
|
|
375
|
+
}).optional(),
|
|
376
|
+
transform: canvasPaintTransformSchema.optional(),
|
|
377
|
+
adjustments: canvasImageAdjustmentsSchema.optional()
|
|
378
|
+
}).refine((paint) => paint.crop === void 0 || paint.transform === void 0, {
|
|
379
|
+
message: "image paint cannot have both a crop rectangle and an affine transform",
|
|
380
|
+
path: ["transform"]
|
|
381
|
+
})
|
|
382
|
+
]);
|
|
383
|
+
const canvasPaintSchema = z.intersection(canvasPaintCoreSchema, z.object({ alternatives: z.partialRecord(z.enum([
|
|
384
|
+
"solid",
|
|
385
|
+
"linear-gradient",
|
|
386
|
+
"radial-gradient",
|
|
387
|
+
"angular-gradient",
|
|
388
|
+
"diamond-gradient",
|
|
389
|
+
"image"
|
|
390
|
+
]), canvasPaintCoreSchema).optional() }));
|
|
391
|
+
const canvasColorDefinitionSchema = z.object({
|
|
392
|
+
id: itemId$1,
|
|
393
|
+
name: z.string().trim().min(1),
|
|
394
|
+
value: z.union([canvasColorSchema.omit({ definitionId: true }), z.object({ definitionId: itemId$1 })]),
|
|
395
|
+
source: z.object({
|
|
396
|
+
kind: z.literal("figma"),
|
|
397
|
+
key: itemId$1,
|
|
398
|
+
modeId: itemId$1.optional()
|
|
399
|
+
}).optional()
|
|
400
|
+
});
|
|
401
|
+
const setCanvasArtworkColorOperationSchema = z.object({
|
|
402
|
+
op: z.literal("setArtworkColor"),
|
|
403
|
+
nodeId: z.literal("root"),
|
|
404
|
+
colorId: z.string().min(1),
|
|
405
|
+
definition: canvasColorDefinitionSchema.nullable()
|
|
406
|
+
}).refine((operation) => operation.definition === null || operation.definition.id === operation.colorId, "colour identity must match");
|
|
407
|
+
|
|
217
408
|
//#endregion
|
|
218
409
|
//#region ../../packages/contract/src/canvas/canvas-layout.schema.ts
|
|
219
410
|
const canvasParentSizeBoundSchema = z.object({
|
|
@@ -231,7 +422,10 @@ const canvasSizeIntentSchema = z.discriminatedUnion("mode", [
|
|
|
231
422
|
mode: z.literal("fixed"),
|
|
232
423
|
value: nonNegativeCanvasNumberSchema
|
|
233
424
|
}).strict(),
|
|
234
|
-
canvasSizeIntentBoundsSchema.extend({
|
|
425
|
+
canvasSizeIntentBoundsSchema.extend({
|
|
426
|
+
mode: z.literal("hug"),
|
|
427
|
+
implicitExtent: nonNegativeCanvasNumberSchema.optional()
|
|
428
|
+
}).strict(),
|
|
235
429
|
canvasSizeIntentBoundsSchema.extend({
|
|
236
430
|
mode: z.literal("fill"),
|
|
237
431
|
offset: canvasNumberSchema.optional()
|
|
@@ -283,9 +477,10 @@ const canvasFlexLayoutSchema = z.object({
|
|
|
283
477
|
"space-around",
|
|
284
478
|
"space-evenly"
|
|
285
479
|
]),
|
|
286
|
-
gap:
|
|
287
|
-
rowGap:
|
|
288
|
-
columnGap:
|
|
480
|
+
gap: canvasNumberSchema,
|
|
481
|
+
rowGap: canvasNumberSchema.optional(),
|
|
482
|
+
columnGap: canvasNumberSchema.optional(),
|
|
483
|
+
crossGapMode: z.literal("auto").optional(),
|
|
289
484
|
wrap: z.enum(["nowrap", "wrap"]).optional(),
|
|
290
485
|
gridColumns: z.number().int().positive().optional(),
|
|
291
486
|
gridAutoRepeat: canvasGridAutoRepeatSchema.optional(),
|
|
@@ -300,6 +495,18 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
300
495
|
horizontal: canvasSizeIntentSchema.optional(),
|
|
301
496
|
vertical: canvasSizeIntentSchema.optional(),
|
|
302
497
|
position: z.enum(["flow", "absolute"]).optional(),
|
|
498
|
+
retainedIgnore: z.literal(true).optional(),
|
|
499
|
+
gridParticipation: z.literal("unassigned").optional(),
|
|
500
|
+
gridEmptyPlacement: z.literal("manual").optional(),
|
|
501
|
+
gridAutoTrackPolicy: z.object({
|
|
502
|
+
rows: z.literal("extend-last").optional(),
|
|
503
|
+
columns: z.literal("extend-last").optional()
|
|
504
|
+
}).strict().optional(),
|
|
505
|
+
retainedFlexSpacing: z.object({
|
|
506
|
+
gap: z.union([canvasNumberSchema, canvasCssValueSchema.min(1)]),
|
|
507
|
+
counterGap: z.union([canvasNumberSchema, canvasCssValueSchema.min(1)]),
|
|
508
|
+
crossGapMode: z.literal("auto").optional()
|
|
509
|
+
}).strict().optional(),
|
|
303
510
|
alignSelf: z.enum([
|
|
304
511
|
"auto",
|
|
305
512
|
"start",
|
|
@@ -323,100 +530,10 @@ const canvasNodeLayoutSchema = z.object({
|
|
|
323
530
|
|
|
324
531
|
//#endregion
|
|
325
532
|
//#region ../../packages/contract/src/canvas/canvas-presentation.schema.ts
|
|
326
|
-
const QUARTER_TURN = 90;
|
|
327
|
-
const HALF_TURN = 180;
|
|
328
|
-
const THREE_QUARTER_TURN = 270;
|
|
329
533
|
const boundedNumber = canvasNumberSchema;
|
|
330
534
|
const nonNegativeNumber$1 = nonNegativeCanvasNumberSchema;
|
|
331
535
|
const ratio = z.number().min(0).max(1);
|
|
332
536
|
const itemId = z.string().min(1);
|
|
333
|
-
const canvasColorSchema = z.object({
|
|
334
|
-
space: z.enum(["srgb", "display-p3"]),
|
|
335
|
-
red: ratio,
|
|
336
|
-
green: ratio,
|
|
337
|
-
blue: ratio,
|
|
338
|
-
alpha: ratio
|
|
339
|
-
});
|
|
340
|
-
const canvasGradientStopSchema = z.object({
|
|
341
|
-
id: itemId,
|
|
342
|
-
position: ratio,
|
|
343
|
-
color: canvasColorSchema
|
|
344
|
-
});
|
|
345
|
-
const canvasPointSchema = z.object({
|
|
346
|
-
x: ratio,
|
|
347
|
-
y: ratio
|
|
348
|
-
});
|
|
349
|
-
const adjustment = z.number().min(-1).max(1);
|
|
350
|
-
const canvasImageAdjustmentsSchema = z.object({
|
|
351
|
-
exposure: adjustment.optional(),
|
|
352
|
-
contrast: adjustment.optional(),
|
|
353
|
-
saturation: adjustment.optional(),
|
|
354
|
-
temperature: adjustment.optional(),
|
|
355
|
-
tint: adjustment.optional(),
|
|
356
|
-
highlights: adjustment.optional(),
|
|
357
|
-
shadows: adjustment.optional()
|
|
358
|
-
});
|
|
359
|
-
/** Maps normalized source (u,v) into body (a*u+c*v+e,b*u+d*v+f), before node rotation. */
|
|
360
|
-
const canvasImageTransformSchema = z.tuple([
|
|
361
|
-
boundedNumber,
|
|
362
|
-
boundedNumber,
|
|
363
|
-
boundedNumber,
|
|
364
|
-
boundedNumber,
|
|
365
|
-
boundedNumber,
|
|
366
|
-
boundedNumber
|
|
367
|
-
]).refine(([a, b, c, d]) => a * d !== b * c, "image transform must be invertible");
|
|
368
|
-
const canvasPaintBaseSchema = z.object({
|
|
369
|
-
id: itemId,
|
|
370
|
-
visible: z.boolean(),
|
|
371
|
-
opacity: ratio
|
|
372
|
-
});
|
|
373
|
-
const canvasPaintSchema = z.discriminatedUnion("kind", [
|
|
374
|
-
canvasPaintBaseSchema.extend({
|
|
375
|
-
kind: z.literal("solid"),
|
|
376
|
-
color: canvasColorSchema
|
|
377
|
-
}),
|
|
378
|
-
canvasPaintBaseSchema.extend({
|
|
379
|
-
kind: z.literal("linear-gradient"),
|
|
380
|
-
angle: boundedNumber,
|
|
381
|
-
stops: z.array(canvasGradientStopSchema).min(2)
|
|
382
|
-
}),
|
|
383
|
-
canvasPaintBaseSchema.extend({
|
|
384
|
-
kind: z.literal("radial-gradient"),
|
|
385
|
-
center: canvasPointSchema,
|
|
386
|
-
radius: canvasPointSchema,
|
|
387
|
-
stops: z.array(canvasGradientStopSchema).min(2)
|
|
388
|
-
}),
|
|
389
|
-
canvasPaintBaseSchema.extend({
|
|
390
|
-
kind: z.literal("image"),
|
|
391
|
-
assetId: z.string().min(1),
|
|
392
|
-
fit: z.enum([
|
|
393
|
-
"fill",
|
|
394
|
-
"cover",
|
|
395
|
-
"fit",
|
|
396
|
-
"crop",
|
|
397
|
-
"tile"
|
|
398
|
-
]),
|
|
399
|
-
tileScale: boundedNumber.positive().optional(),
|
|
400
|
-
tileOrigin: z.enum(["center", "top-left"]).optional(),
|
|
401
|
-
rotation: z.union([
|
|
402
|
-
z.literal(0),
|
|
403
|
-
z.literal(QUARTER_TURN),
|
|
404
|
-
z.literal(HALF_TURN),
|
|
405
|
-
z.literal(THREE_QUARTER_TURN)
|
|
406
|
-
]).optional(),
|
|
407
|
-
crop: z.object({
|
|
408
|
-
x: ratio,
|
|
409
|
-
y: ratio,
|
|
410
|
-
width: ratio,
|
|
411
|
-
height: ratio
|
|
412
|
-
}).optional(),
|
|
413
|
-
transform: canvasImageTransformSchema.optional(),
|
|
414
|
-
adjustments: canvasImageAdjustmentsSchema.optional()
|
|
415
|
-
}).refine((paint) => paint.crop === void 0 || paint.transform === void 0, {
|
|
416
|
-
message: "image paint cannot have both a crop rectangle and an affine transform",
|
|
417
|
-
path: ["transform"]
|
|
418
|
-
})
|
|
419
|
-
]);
|
|
420
537
|
const canvasCornerRadiusSchema = z.object({
|
|
421
538
|
topLeft: nonNegativeNumber$1,
|
|
422
539
|
topRight: nonNegativeNumber$1,
|
|
@@ -426,6 +543,12 @@ const canvasCornerRadiusSchema = z.object({
|
|
|
426
543
|
});
|
|
427
544
|
const canvasBorderSchema = z.object({
|
|
428
545
|
visible: z.boolean(),
|
|
546
|
+
/** Absent reserves CSS widths; visible reserves only visible paint, while none separates paint from layout. */
|
|
547
|
+
layoutInclusion: z.enum([
|
|
548
|
+
"always",
|
|
549
|
+
"visible",
|
|
550
|
+
"none"
|
|
551
|
+
]).optional(),
|
|
429
552
|
width: z.object({
|
|
430
553
|
top: nonNegativeNumber$1,
|
|
431
554
|
right: nonNegativeNumber$1,
|
|
@@ -439,6 +562,11 @@ const canvasBorderSchema = z.object({
|
|
|
439
562
|
]),
|
|
440
563
|
paint: canvasPaintSchema
|
|
441
564
|
});
|
|
565
|
+
const retainedBorderSchema = canvasBorderSchema.pick({
|
|
566
|
+
width: true,
|
|
567
|
+
style: true,
|
|
568
|
+
layoutInclusion: true
|
|
569
|
+
});
|
|
442
570
|
const canvasOutlineSchema = z.object({
|
|
443
571
|
visible: z.boolean(),
|
|
444
572
|
width: nonNegativeNumber$1,
|
|
@@ -458,7 +586,10 @@ const canvasShadowSchema = z.object({
|
|
|
458
586
|
offsetX: boundedNumber,
|
|
459
587
|
offsetY: boundedNumber,
|
|
460
588
|
blur: nonNegativeNumber$1,
|
|
461
|
-
spread: boundedNumber
|
|
589
|
+
spread: boundedNumber,
|
|
590
|
+
blendMode: canvasBlendModeSchema.optional(),
|
|
591
|
+
blendSource: canvasBlendSourceSchema.optional(),
|
|
592
|
+
isShownBehindNode: z.boolean().optional()
|
|
462
593
|
});
|
|
463
594
|
const canvasFilterBaseSchema = z.object({
|
|
464
595
|
id: itemId,
|
|
@@ -467,7 +598,20 @@ const canvasFilterBaseSchema = z.object({
|
|
|
467
598
|
const canvasFilterSchema = z.discriminatedUnion("kind", [
|
|
468
599
|
canvasFilterBaseSchema.extend({
|
|
469
600
|
kind: z.literal("blur"),
|
|
470
|
-
value: nonNegativeNumber$1
|
|
601
|
+
value: nonNegativeNumber$1,
|
|
602
|
+
parameter: z.enum(["radius", "standard-deviation"]).optional(),
|
|
603
|
+
/** Endpoints use normalized body coordinates; startValue uses the filter's authored unit. */
|
|
604
|
+
progression: z.object({
|
|
605
|
+
startValue: nonNegativeNumber$1,
|
|
606
|
+
start: z.object({
|
|
607
|
+
x: boundedNumber,
|
|
608
|
+
y: boundedNumber
|
|
609
|
+
}),
|
|
610
|
+
end: z.object({
|
|
611
|
+
x: boundedNumber,
|
|
612
|
+
y: boundedNumber
|
|
613
|
+
})
|
|
614
|
+
}).optional()
|
|
471
615
|
}),
|
|
472
616
|
canvasFilterBaseSchema.extend({
|
|
473
617
|
kind: z.literal("brightness"),
|
|
@@ -498,53 +642,25 @@ const canvasFilterSchema = z.discriminatedUnion("kind", [
|
|
|
498
642
|
value: ratio
|
|
499
643
|
})
|
|
500
644
|
]);
|
|
501
|
-
const CANVAS_BLEND_MODES = [
|
|
502
|
-
"normal",
|
|
503
|
-
"multiply",
|
|
504
|
-
"screen",
|
|
505
|
-
"overlay",
|
|
506
|
-
"darken",
|
|
507
|
-
"lighten",
|
|
508
|
-
"plus-lighter",
|
|
509
|
-
"color-dodge",
|
|
510
|
-
"color-burn",
|
|
511
|
-
"hard-light",
|
|
512
|
-
"soft-light",
|
|
513
|
-
"difference",
|
|
514
|
-
"exclusion",
|
|
515
|
-
"hue",
|
|
516
|
-
"saturation",
|
|
517
|
-
"color",
|
|
518
|
-
"luminosity"
|
|
519
|
-
];
|
|
520
|
-
const canvasBlendModeSchema = z.enum(CANVAS_BLEND_MODES);
|
|
521
645
|
const canvasAppearanceSchema = z.object({
|
|
522
646
|
opacity: ratio,
|
|
523
647
|
blendMode: canvasBlendModeSchema,
|
|
524
648
|
fills: z.array(canvasPaintSchema),
|
|
525
649
|
border: canvasBorderSchema,
|
|
650
|
+
retainedBorder: retainedBorderSchema.optional(),
|
|
526
651
|
outline: canvasOutlineSchema,
|
|
527
652
|
radius: canvasCornerRadiusSchema,
|
|
528
653
|
shadows: z.array(canvasShadowSchema),
|
|
529
654
|
filters: z.array(canvasFilterSchema),
|
|
530
655
|
backdropFilters: z.array(canvasFilterSchema)
|
|
531
656
|
});
|
|
532
|
-
const canvasAppearanceValuesSchema =
|
|
533
|
-
opacity: ratio.optional(),
|
|
534
|
-
blendMode: canvasBlendModeSchema.optional(),
|
|
535
|
-
fills: z.array(canvasPaintSchema).optional(),
|
|
536
|
-
border: canvasBorderSchema.optional(),
|
|
537
|
-
outline: canvasOutlineSchema.optional(),
|
|
538
|
-
radius: canvasCornerRadiusSchema.optional(),
|
|
539
|
-
shadows: z.array(canvasShadowSchema).optional(),
|
|
540
|
-
filters: z.array(canvasFilterSchema).optional(),
|
|
541
|
-
backdropFilters: z.array(canvasFilterSchema).optional()
|
|
542
|
-
}).refine((values) => Object.keys(values).length > 0, "appearance values cannot be empty");
|
|
657
|
+
const canvasAppearanceValuesSchema = canvasAppearanceSchema.partial().refine((values) => Object.keys(values).length > 0, "appearance values cannot be empty");
|
|
543
658
|
const CANVAS_APPEARANCE_PROPERTIES = [
|
|
544
659
|
"opacity",
|
|
545
660
|
"blendMode",
|
|
546
661
|
"fills",
|
|
547
662
|
"border",
|
|
663
|
+
"retainedBorder",
|
|
548
664
|
"outline",
|
|
549
665
|
"radius",
|
|
550
666
|
"shadows",
|
|
@@ -552,18 +668,7 @@ const CANVAS_APPEARANCE_PROPERTIES = [
|
|
|
552
668
|
"backdropFilters"
|
|
553
669
|
];
|
|
554
670
|
const canvasAppearancePropertySchema = z.enum(CANVAS_APPEARANCE_PROPERTIES);
|
|
555
|
-
const canvasAppearancePatchSchema = z.
|
|
556
|
-
opacity: ratio.optional(),
|
|
557
|
-
blendMode: canvasBlendModeSchema.optional(),
|
|
558
|
-
fills: z.array(canvasPaintSchema).optional(),
|
|
559
|
-
border: canvasBorderSchema.optional(),
|
|
560
|
-
outline: canvasOutlineSchema.optional(),
|
|
561
|
-
radius: canvasCornerRadiusSchema.optional(),
|
|
562
|
-
shadows: z.array(canvasShadowSchema).optional(),
|
|
563
|
-
filters: z.array(canvasFilterSchema).optional(),
|
|
564
|
-
backdropFilters: z.array(canvasFilterSchema).optional(),
|
|
565
|
-
clear: z.array(canvasAppearancePropertySchema).min(1).max(CANVAS_APPEARANCE_PROPERTIES.length).optional()
|
|
566
|
-
}).refine((patch) => Object.keys(patch).length > 0, "appearance patch cannot be empty").refine(({ clear, ...values }) => clear === void 0 || clear.every((property) => values[property] === void 0), "appearance patch cannot set and clear the same property");
|
|
671
|
+
const canvasAppearancePatchSchema = canvasAppearanceSchema.partial().extend({ clear: z.array(canvasAppearancePropertySchema).min(1).max(CANVAS_APPEARANCE_PROPERTIES.length).optional() }).refine((patch) => Object.keys(patch).length > 0, "appearance patch cannot be empty").refine(({ clear, ...values }) => clear === void 0 || clear.every((property) => values[property] === void 0), "appearance patch cannot set and clear the same property");
|
|
567
672
|
|
|
568
673
|
//#endregion
|
|
569
674
|
//#region ../../packages/contract/src/canvas/canvas-content-styles.schema.ts
|
|
@@ -645,6 +750,7 @@ const canvasTypographySchema = z.object({
|
|
|
645
750
|
"wavy"
|
|
646
751
|
]),
|
|
647
752
|
color: canvasColorSchema.optional(),
|
|
753
|
+
blendMode: canvasBlendModeSchema.optional(),
|
|
648
754
|
thickness: z.union([
|
|
649
755
|
nonNegativeNumber,
|
|
650
756
|
z.object({
|
|
@@ -776,27 +882,352 @@ const CANVAS_TYPOGRAPHY_CSS_OWNERS = {
|
|
|
776
882
|
"text-wrap-style": ["wrapStyle"],
|
|
777
883
|
"text-wrap": ["wrapStyle"]
|
|
778
884
|
};
|
|
779
|
-
const unsafeStyleValue = /javascript|vbscript|data\s*:\s*text\/html|expression\s*\(|@import/iu;
|
|
780
885
|
const blockedStyleProperty = /^(?:behavior|-moz-binding)$/iu;
|
|
781
886
|
const canvasAdditionalStylePropertySchema = z.string().min(1).regex(/^(?:--[\w-]+|-(?:webkit|moz|ms|o)-[a-z][a-z\d-]*|[a-z][a-z\d-]*)$/iu).refine((property) => !blockedStyleProperty.test(property), "unsafe CSS property");
|
|
782
|
-
const canvasAdditionalStyleValueSchema = z.string().refine((value) => !unsafeStyleValue.test(value), "unsafe CSS value");
|
|
783
887
|
const canvasAdditionalStyleSchema = z.object({
|
|
784
888
|
id: z.string().min(1),
|
|
785
889
|
property: canvasAdditionalStylePropertySchema,
|
|
786
|
-
value:
|
|
890
|
+
value: canvasCssValueSchema,
|
|
787
891
|
enabled: z.boolean()
|
|
788
892
|
});
|
|
789
|
-
const canvasAdditionalStylesSchema = z.object({ declarations: z.array(canvasAdditionalStyleSchema) }).refine(({ declarations }) => new Set(declarations.map((declaration) => declaration.id)).size === declarations.length, "additional style ids must be unique");
|
|
893
|
+
const canvasAdditionalStylesSchema = z.object({ declarations: z.array(canvasAdditionalStyleSchema) }).refine(({ declarations }) => new Set(declarations.map((declaration) => declaration.id)).size === declarations.length, "additional style ids must be unique");
|
|
894
|
+
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region ../../packages/contract/src/canvas/canvas-additional-style-patch.schema.ts
|
|
897
|
+
const identifiers = z.array(canvasAdditionalStyleSchema.shape.id).refine((ids) => new Set(ids).size === ids.length, "declaration ids must be unique");
|
|
898
|
+
const canvasAdditionalStylePatchSchema = z.object({
|
|
899
|
+
set: z.array(canvasAdditionalStyleSchema).refine((items) => new Set(items.map((item) => item.id)).size === items.length, "declaration ids must be unique").optional(),
|
|
900
|
+
clear: identifiers.optional(),
|
|
901
|
+
order: identifiers.optional(),
|
|
902
|
+
empty: z.enum(["keep", "remove"]).optional()
|
|
903
|
+
}).strict().refine((patch) => patch.set?.every((item) => patch.clear?.includes(item.id) !== true) ?? true, "a declaration cannot be set and cleared in the same patch");
|
|
904
|
+
|
|
905
|
+
//#endregion
|
|
906
|
+
//#region ../../packages/contract/src/canvas/canvas-text-links.lib.ts
|
|
907
|
+
const FORBIDDEN_DOMAIN_CHARACTERS = /* @__PURE__ */ new Set([
|
|
908
|
+
"#",
|
|
909
|
+
"%",
|
|
910
|
+
"/",
|
|
911
|
+
":",
|
|
912
|
+
"<",
|
|
913
|
+
">",
|
|
914
|
+
"?",
|
|
915
|
+
"@",
|
|
916
|
+
"[",
|
|
917
|
+
"\\",
|
|
918
|
+
"]",
|
|
919
|
+
"^",
|
|
920
|
+
"|"
|
|
921
|
+
]);
|
|
922
|
+
const ASCII_SPACE = 32;
|
|
923
|
+
const ASCII_DELETE = 127;
|
|
924
|
+
/** Check the decoded host because browser URL parsing can retain host spaces as percent escapes. */
|
|
925
|
+
const isHttpHostname = (url) => {
|
|
926
|
+
if (url.hostname.startsWith("[")) return true;
|
|
927
|
+
const hostname = decodeURIComponent(url.hostname);
|
|
928
|
+
for (const character of hostname) {
|
|
929
|
+
const point = character.codePointAt(0) ?? 0;
|
|
930
|
+
if (point === ASCII_DELETE || point <= ASCII_SPACE || FORBIDDEN_DOMAIN_CHARACTERS.has(character)) return false;
|
|
931
|
+
}
|
|
932
|
+
return hostname !== "";
|
|
933
|
+
};
|
|
934
|
+
const SAFE_HREF_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
935
|
+
"http:",
|
|
936
|
+
"https:",
|
|
937
|
+
"mailto:",
|
|
938
|
+
"tel:"
|
|
939
|
+
]);
|
|
940
|
+
const isCanvasRichTextHref = (value) => {
|
|
941
|
+
const href = value.trim();
|
|
942
|
+
if (href === "") return false;
|
|
943
|
+
try {
|
|
944
|
+
const url = new URL(href, "https://enhance.invalid/");
|
|
945
|
+
return SAFE_HREF_PROTOCOLS.has(url.protocol) && (!["http:", "https:"].includes(url.protocol) || isHttpHostname(url));
|
|
946
|
+
} catch {
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
//#endregion
|
|
952
|
+
//#region ../../packages/contract/src/canvas/canvas-rich-text.consts.ts
|
|
953
|
+
const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
954
|
+
"alignItems",
|
|
955
|
+
"backgroundColor",
|
|
956
|
+
"borderBottom",
|
|
957
|
+
"borderBottomLeftRadius",
|
|
958
|
+
"borderBottomRightRadius",
|
|
959
|
+
"borderLeft",
|
|
960
|
+
"borderRight",
|
|
961
|
+
"borderTop",
|
|
962
|
+
"borderTopLeftRadius",
|
|
963
|
+
"borderTopRightRadius",
|
|
964
|
+
"boxShadow",
|
|
965
|
+
"boxSizing",
|
|
966
|
+
"color",
|
|
967
|
+
"columnGap",
|
|
968
|
+
"display",
|
|
969
|
+
"flexDirection",
|
|
970
|
+
"fontFamily",
|
|
971
|
+
"fontFeatureSettings",
|
|
972
|
+
"fontOpticalSizing",
|
|
973
|
+
"fontSize",
|
|
974
|
+
"fontStretch",
|
|
975
|
+
"fontStyle",
|
|
976
|
+
"fontVariant",
|
|
977
|
+
"fontVariantCaps",
|
|
978
|
+
"fontVariantLigatures",
|
|
979
|
+
"fontVariantNumeric",
|
|
980
|
+
"fontVariantPosition",
|
|
981
|
+
"fontKerning",
|
|
982
|
+
"fontVariationSettings",
|
|
983
|
+
"fontWeight",
|
|
984
|
+
"justifyContent",
|
|
985
|
+
"letterSpacing",
|
|
986
|
+
"lineHeight",
|
|
987
|
+
"marginBottom",
|
|
988
|
+
"marginLeft",
|
|
989
|
+
"marginRight",
|
|
990
|
+
"marginTop",
|
|
991
|
+
"opacity",
|
|
992
|
+
"paddingBottom",
|
|
993
|
+
"paddingLeft",
|
|
994
|
+
"paddingRight",
|
|
995
|
+
"paddingTop",
|
|
996
|
+
"rowGap",
|
|
997
|
+
"textDecorationColor",
|
|
998
|
+
"textDecorationLine",
|
|
999
|
+
"textDecorationSkipInk",
|
|
1000
|
+
"textDecorationStyle",
|
|
1001
|
+
"textDecorationThickness",
|
|
1002
|
+
"textShadow",
|
|
1003
|
+
"textTransform",
|
|
1004
|
+
"textUnderlineOffset",
|
|
1005
|
+
"verticalAlign",
|
|
1006
|
+
"whiteSpace",
|
|
1007
|
+
"WebkitTextStrokeColor",
|
|
1008
|
+
"WebkitTextStrokeWidth",
|
|
1009
|
+
"--canvas-text-stroke-alignment"
|
|
1010
|
+
]);
|
|
1011
|
+
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region ../../packages/contract/src/canvas/canvas-text-style.schema.ts
|
|
1014
|
+
const MAX_DESCRIPTION$1 = 2e3;
|
|
1015
|
+
const MAX_OVERRIDE_VALUE = 1e3;
|
|
1016
|
+
const canvasTextStyleTypographySchema = canvasTypographySchema.pick({
|
|
1017
|
+
family: true,
|
|
1018
|
+
fallbackFamilies: true,
|
|
1019
|
+
size: true,
|
|
1020
|
+
weight: true,
|
|
1021
|
+
style: true,
|
|
1022
|
+
variations: true,
|
|
1023
|
+
opticalSize: true,
|
|
1024
|
+
features: true,
|
|
1025
|
+
lineHeight: true,
|
|
1026
|
+
letterSpacing: true,
|
|
1027
|
+
transform: true,
|
|
1028
|
+
decoration: true,
|
|
1029
|
+
paragraphSpacing: true,
|
|
1030
|
+
paragraphIndent: true,
|
|
1031
|
+
listSpacing: true,
|
|
1032
|
+
hangingList: true,
|
|
1033
|
+
hangingPunctuation: true,
|
|
1034
|
+
verticalTrim: true,
|
|
1035
|
+
wrapStyle: true
|
|
1036
|
+
}).extend({ decoration: canvasTypographySchema.shape.decoration.omit({ blendMode: true }) }).strict();
|
|
1037
|
+
const CANVAS_TEXT_STYLE_PROPERTIES = canvasTextStyleTypographySchema.keyof().options;
|
|
1038
|
+
const canvasTextStyleSchema = z.object({
|
|
1039
|
+
id: z.string().min(1),
|
|
1040
|
+
name: z.string().trim().min(1),
|
|
1041
|
+
description: z.string().max(MAX_DESCRIPTION$1),
|
|
1042
|
+
sortKey: z.string().min(1).optional(),
|
|
1043
|
+
sourceStyleId: z.string().min(1).optional(),
|
|
1044
|
+
sourceCanvasId: z.uuid().optional(),
|
|
1045
|
+
sourceRevision: z.number().int().positive().optional(),
|
|
1046
|
+
typography: canvasTextStyleTypographySchema.extend({ listStyle: canvasTypographySchema.shape.listStyle }).transform((typography) => {
|
|
1047
|
+
Reflect.deleteProperty(typography, "listStyle");
|
|
1048
|
+
return typography;
|
|
1049
|
+
})
|
|
1050
|
+
}).strict().refine((style) => style.sourceCanvasId === void 0 || style.sourceStyleId !== void 0, {
|
|
1051
|
+
message: "A source canvas belongs to a reference snapshot.",
|
|
1052
|
+
path: ["sourceCanvasId"]
|
|
1053
|
+
}).refine((style) => style.sourceRevision === void 0 || style.sourceCanvasId !== void 0 && style.sourceStyleId !== void 0, {
|
|
1054
|
+
message: "A published revision belongs to a source style and canvas.",
|
|
1055
|
+
path: ["sourceRevision"]
|
|
1056
|
+
});
|
|
1057
|
+
const canvasTextStyleBindingSchema = z.object({
|
|
1058
|
+
id: canvasTextStyleSchema.shape.id,
|
|
1059
|
+
position: z.enum([
|
|
1060
|
+
"normal",
|
|
1061
|
+
"subscript",
|
|
1062
|
+
"superscript"
|
|
1063
|
+
]).optional(),
|
|
1064
|
+
overrides: z.partialRecord(z.enum([
|
|
1065
|
+
"fontWeight",
|
|
1066
|
+
"fontStyle",
|
|
1067
|
+
"fontVariationSettings",
|
|
1068
|
+
"fontOpticalSizing",
|
|
1069
|
+
"textDecorationLine",
|
|
1070
|
+
"textDecorationStyle",
|
|
1071
|
+
"textDecorationColor",
|
|
1072
|
+
"textDecorationThickness",
|
|
1073
|
+
"textUnderlineOffset",
|
|
1074
|
+
"textDecorationSkipInk"
|
|
1075
|
+
]), z.union([z.string().max(MAX_OVERRIDE_VALUE), z.number()])).optional()
|
|
1076
|
+
}).strict();
|
|
790
1077
|
|
|
791
1078
|
//#endregion
|
|
792
|
-
//#region ../../packages/contract/src/canvas/canvas-
|
|
793
|
-
const
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}).
|
|
1079
|
+
//#region ../../packages/contract/src/canvas/canvas-rich-text.lib.ts
|
|
1080
|
+
const fillsSchema = canvasPaintSchema.array().optional();
|
|
1081
|
+
const characterFormattingSchema = canvasTextParagraphSchema.pick({
|
|
1082
|
+
paragraphSpacing: true,
|
|
1083
|
+
paragraphIndent: true,
|
|
1084
|
+
listSpacing: true,
|
|
1085
|
+
wrapStyle: true
|
|
1086
|
+
}).extend({
|
|
1087
|
+
hangingPunctuation: canvasTypographySchema.shape.hangingPunctuation,
|
|
1088
|
+
verticalTrim: canvasTypographySchema.shape.verticalTrim,
|
|
1089
|
+
stroke: canvasTypographySchema.shape.stroke.nullable(),
|
|
1090
|
+
decorationBlendMode: canvasTypographySchema.shape.decoration.shape.blendMode,
|
|
1091
|
+
backgroundBlendMode: canvasBlendModeSchema.optional()
|
|
1092
|
+
}).strip();
|
|
1093
|
+
const safeHref = (value) => typeof value === "string" && isCanvasRichTextHref(value) ? value : void 0;
|
|
1094
|
+
const richStylesOf = (value) => {
|
|
1095
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1096
|
+
const entries = Object.entries(value);
|
|
1097
|
+
if (entries.some(([property, styleValue]) => !CANVAS_RICH_TEXT_STYLE_PROPERTIES.has(property) || typeof styleValue !== "string" && typeof styleValue !== "number")) return null;
|
|
1098
|
+
return Object.fromEntries(entries);
|
|
1099
|
+
};
|
|
1100
|
+
const richMetadataOf = (value) => {
|
|
1101
|
+
const sourcePath = Reflect.get(value, "sourcePath");
|
|
1102
|
+
return {
|
|
1103
|
+
...Object.fromEntries(Object.entries(value).filter(([key]) => ![
|
|
1104
|
+
"text",
|
|
1105
|
+
"href",
|
|
1106
|
+
"sourcePath",
|
|
1107
|
+
"styles",
|
|
1108
|
+
"fills",
|
|
1109
|
+
"stroke",
|
|
1110
|
+
"decorationBlendMode",
|
|
1111
|
+
"backgroundBlendMode",
|
|
1112
|
+
"paragraph",
|
|
1113
|
+
"paragraphSpacing",
|
|
1114
|
+
"paragraphIndent",
|
|
1115
|
+
"listSpacing",
|
|
1116
|
+
"hangingPunctuation",
|
|
1117
|
+
"verticalTrim",
|
|
1118
|
+
"wrapStyle",
|
|
1119
|
+
"soft",
|
|
1120
|
+
"textStyle"
|
|
1121
|
+
].includes(key))),
|
|
1122
|
+
...typeof sourcePath === "string" && { sourcePath }
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
const richChildrenOf = (values) => {
|
|
1126
|
+
const result = [];
|
|
1127
|
+
const pending = values.toReversed().map((value) => ({
|
|
1128
|
+
value,
|
|
1129
|
+
target: result
|
|
1130
|
+
}));
|
|
1131
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
1132
|
+
while (pending.length > 0) {
|
|
1133
|
+
const task = pending.pop();
|
|
1134
|
+
if (task === void 0) continue;
|
|
1135
|
+
if ("done" in task) {
|
|
1136
|
+
ancestors.delete(task.done);
|
|
1137
|
+
continue;
|
|
1138
|
+
}
|
|
1139
|
+
const children = [];
|
|
1140
|
+
const node = richNodeOf(task.value, children);
|
|
1141
|
+
if (node === null) return null;
|
|
1142
|
+
task.target.push(node);
|
|
1143
|
+
if (node.kind !== "span") continue;
|
|
1144
|
+
const value = task.value;
|
|
1145
|
+
if (typeof value !== "object" || value === null || ancestors.has(value)) return null;
|
|
1146
|
+
ancestors.add(value);
|
|
1147
|
+
pending.push({ done: value });
|
|
1148
|
+
const nested = Reflect.get(value, "children");
|
|
1149
|
+
if (!Array.isArray(nested)) return null;
|
|
1150
|
+
const candidates = nested;
|
|
1151
|
+
for (const child of candidates.toReversed()) pending.push({
|
|
1152
|
+
value: child,
|
|
1153
|
+
target: children
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
return result;
|
|
1157
|
+
};
|
|
1158
|
+
const richBreakOf = (value) => {
|
|
1159
|
+
const soft = Reflect.get(value, "soft");
|
|
1160
|
+
if (soft !== void 0 && soft !== true) return null;
|
|
1161
|
+
return {
|
|
1162
|
+
...richMetadataOf(value),
|
|
1163
|
+
kind: "break",
|
|
1164
|
+
...soft === true && { soft }
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
const richNodeOf = (value, children) => {
|
|
1168
|
+
if (typeof value !== "object" || value === null) return null;
|
|
1169
|
+
const kind = Reflect.get(value, "kind");
|
|
1170
|
+
const metadata = richMetadataOf(value);
|
|
1171
|
+
if (kind === "break") return richBreakOf(value);
|
|
1172
|
+
if (kind === "text") {
|
|
1173
|
+
const text = Reflect.get(value, "text");
|
|
1174
|
+
return typeof text === "string" ? {
|
|
1175
|
+
...metadata,
|
|
1176
|
+
kind,
|
|
1177
|
+
text
|
|
1178
|
+
} : null;
|
|
1179
|
+
}
|
|
1180
|
+
if (kind !== "span") return null;
|
|
1181
|
+
const values = Reflect.get(value, "children");
|
|
1182
|
+
const styles = richStylesOf(Reflect.get(value, "styles"));
|
|
1183
|
+
const fills = fillsSchema.safeParse(Reflect.get(value, "fills"));
|
|
1184
|
+
const paragraph = canvasTextParagraphSchema.optional().safeParse(Reflect.get(value, "paragraph"));
|
|
1185
|
+
const formatting = characterFormattingSchema.safeParse(value);
|
|
1186
|
+
const textStyle = canvasTextStyleBindingSchema.optional().safeParse(Reflect.get(value, "textStyle"));
|
|
1187
|
+
if (styles === null || !fills.success || !paragraph.success || !formatting.success || !textStyle.success || !Array.isArray(values)) return null;
|
|
1188
|
+
const href = safeHref(Reflect.get(value, "href"));
|
|
1189
|
+
return {
|
|
1190
|
+
...metadata,
|
|
1191
|
+
kind,
|
|
1192
|
+
styles,
|
|
1193
|
+
children,
|
|
1194
|
+
...textStyle.data !== void 0 && { textStyle: textStyle.data },
|
|
1195
|
+
...fills.data !== void 0 && { fills: fills.data },
|
|
1196
|
+
...paragraph.data !== void 0 && { paragraph: paragraph.data },
|
|
1197
|
+
...Object.fromEntries(Object.entries(formatting.data).filter(([, entry]) => entry !== void 0)),
|
|
1198
|
+
...href !== void 0 && { href }
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
const richTextLeafValue = (node) => node.kind === "text" ? node.text : node.soft === true ? "\u2028" : "\n";
|
|
1202
|
+
const canvasRichTextValueOf = (nodes) => {
|
|
1203
|
+
const pending = nodes.toReversed();
|
|
1204
|
+
const text = [];
|
|
1205
|
+
while (pending.length > 0) {
|
|
1206
|
+
const node = pending.pop();
|
|
1207
|
+
if (node === void 0) break;
|
|
1208
|
+
if (node.kind === "span") for (const child of node.children.toReversed()) pending.push(child);
|
|
1209
|
+
else text.push(richTextLeafValue(node));
|
|
1210
|
+
}
|
|
1211
|
+
return text.join("");
|
|
1212
|
+
};
|
|
1213
|
+
const canvasRichTextOf = (node) => {
|
|
1214
|
+
const props = node.props;
|
|
1215
|
+
if (props === void 0 || !Array.isArray(props["richText"])) return [];
|
|
1216
|
+
const rich = richChildrenOf(props["richText"]);
|
|
1217
|
+
if (rich === null) return [];
|
|
1218
|
+
const text = props["text"];
|
|
1219
|
+
return canvasRichTextValueOf(rich) === text ? rich : [];
|
|
1220
|
+
};
|
|
1221
|
+
/** Existing-link edits retain authored formatting, including nested descendants. */
|
|
1222
|
+
const canvasRichTextLinkOf = (runs) => {
|
|
1223
|
+
const destinations = /* @__PURE__ */ new Set();
|
|
1224
|
+
const visit = (nodes, inherited) => {
|
|
1225
|
+
for (const node of nodes) if (node.kind === "span") visit(node.children, node.href ?? inherited);
|
|
1226
|
+
else destinations.add(inherited);
|
|
1227
|
+
};
|
|
1228
|
+
visit(runs);
|
|
1229
|
+
return destinations.size === 1 ? [...destinations][0] ?? null : null;
|
|
1230
|
+
};
|
|
800
1231
|
|
|
801
1232
|
//#endregion
|
|
802
1233
|
//#region ../../packages/contract/src/shared/blob.schema.ts
|
|
@@ -1223,6 +1654,19 @@ const canvasLayoutMainAxisOf = (node, document) => {
|
|
|
1223
1654
|
return direction.startsWith("column") === isVerticalWriting ? "horizontal" : "vertical";
|
|
1224
1655
|
};
|
|
1225
1656
|
|
|
1657
|
+
//#endregion
|
|
1658
|
+
//#region ../../packages/contract/src/canvas/canvas-compositing.schema.ts
|
|
1659
|
+
const canvasCompositingSchema = z.strictObject({
|
|
1660
|
+
groupMode: z.enum(["pass-through", "isolated"]).optional(),
|
|
1661
|
+
mask: z.enum([
|
|
1662
|
+
"alpha",
|
|
1663
|
+
"luminance",
|
|
1664
|
+
"vector"
|
|
1665
|
+
]).optional(),
|
|
1666
|
+
/** Absence retains the stored document's legacy paint and isolation behavior. */
|
|
1667
|
+
paintSemantics: z.literal("web").optional()
|
|
1668
|
+
}).refine((value) => value.groupMode !== void 0 || value.mask !== void 0 || value.paintSemantics !== void 0, "compositing intent cannot be empty");
|
|
1669
|
+
|
|
1226
1670
|
//#endregion
|
|
1227
1671
|
//#region ../../packages/canvas-format/src/canvas-format.consts.ts
|
|
1228
1672
|
/** Historical formats stay pinned; an ordinary writer always uses CANVAS_SCENE_VERSION. */
|
|
@@ -1233,7 +1677,11 @@ const LEGACY_CANVAS_FORMATS = {
|
|
|
1233
1677
|
v3: 3,
|
|
1234
1678
|
v4: 4,
|
|
1235
1679
|
v5: 5,
|
|
1236
|
-
v6: 6
|
|
1680
|
+
v6: 6,
|
|
1681
|
+
v7: 7,
|
|
1682
|
+
v8: 8,
|
|
1683
|
+
v9: 9,
|
|
1684
|
+
v10: 10
|
|
1237
1685
|
};
|
|
1238
1686
|
const LEGACY_CANVAS_ADAPTATIONS = {
|
|
1239
1687
|
[LEGACY_CANVAS_FORMATS.v1]: "layout",
|
|
@@ -1241,12 +1689,16 @@ const LEGACY_CANVAS_ADAPTATIONS = {
|
|
|
1241
1689
|
[LEGACY_CANVAS_FORMATS.v3]: "typography",
|
|
1242
1690
|
[LEGACY_CANVAS_FORMATS.v4]: "typography",
|
|
1243
1691
|
[LEGACY_CANVAS_FORMATS.v5]: "typography",
|
|
1244
|
-
[LEGACY_CANVAS_FORMATS.v6]: "geometry"
|
|
1692
|
+
[LEGACY_CANVAS_FORMATS.v6]: "geometry",
|
|
1693
|
+
[LEGACY_CANVAS_FORMATS.v7]: "geometry",
|
|
1694
|
+
[LEGACY_CANVAS_FORMATS.v8]: "geometry",
|
|
1695
|
+
[LEGACY_CANVAS_FORMATS.v9]: "geometry",
|
|
1696
|
+
[LEGACY_CANVAS_FORMATS.v10]: "geometry"
|
|
1245
1697
|
};
|
|
1246
1698
|
|
|
1247
1699
|
//#endregion
|
|
1248
1700
|
//#region ../../packages/canvas-format/src/canvas-format.lib.ts
|
|
1249
|
-
const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS),
|
|
1701
|
+
const READABLE_FORMATS = /* @__PURE__ */ new Set([...Object.values(LEGACY_CANVAS_FORMATS), 11]);
|
|
1250
1702
|
const isReadableCanvasFormat = (version) => READABLE_FORMATS.has(version);
|
|
1251
1703
|
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1252
1704
|
const legacyLayout = (layout) => {
|
|
@@ -1264,20 +1716,20 @@ const legacyLayout = (layout) => {
|
|
|
1264
1716
|
const adaptCanvasDocumentFormat = (document) => {
|
|
1265
1717
|
const version = document["version"];
|
|
1266
1718
|
if (!isReadableCanvasFormat(version)) return null;
|
|
1267
|
-
if (version ===
|
|
1719
|
+
if (version === 11 || !isRecord$1(document["nodes"])) return document;
|
|
1268
1720
|
const adaptation = Object.entries(LEGACY_CANVAS_ADAPTATIONS).find(([format]) => Number(format) === version)?.[1];
|
|
1269
1721
|
if (adaptation === "geometry") return {
|
|
1270
1722
|
...document,
|
|
1271
|
-
version:
|
|
1723
|
+
version: 11
|
|
1272
1724
|
};
|
|
1273
1725
|
if (Object.values(document["nodes"]).some((node) => isRecord$1(node) && node["geometry"] !== void 0)) return null;
|
|
1274
1726
|
if (adaptation === "typography") return {
|
|
1275
1727
|
...document,
|
|
1276
|
-
version:
|
|
1728
|
+
version: 11
|
|
1277
1729
|
};
|
|
1278
1730
|
return {
|
|
1279
1731
|
...document,
|
|
1280
|
-
version:
|
|
1732
|
+
version: 11,
|
|
1281
1733
|
nodes: Object.fromEntries(Object.entries(document["nodes"]).map(([id, node]) => [id, isRecord$1(node) && node["layout"] !== void 0 ? {
|
|
1282
1734
|
...node,
|
|
1283
1735
|
layout: legacyLayout(node["layout"])
|
|
@@ -1285,11 +1737,26 @@ const adaptCanvasDocumentFormat = (document) => {
|
|
|
1285
1737
|
};
|
|
1286
1738
|
};
|
|
1287
1739
|
|
|
1740
|
+
//#endregion
|
|
1741
|
+
//#region ../../packages/contract/src/canvas/canvas-export-settings.schema.ts
|
|
1742
|
+
const format = z.enum(["png", "jpeg"]);
|
|
1743
|
+
const scale = z.number().positive();
|
|
1744
|
+
const canvasExportSettingsSchema = z.strictObject({
|
|
1745
|
+
format: format.optional(),
|
|
1746
|
+
scale: scale.optional()
|
|
1747
|
+
});
|
|
1748
|
+
const canvasExportSettingsPatchSchema = z.strictObject({
|
|
1749
|
+
format: format.nullable().optional(),
|
|
1750
|
+
scale: scale.nullable().optional()
|
|
1751
|
+
}).refine((patch) => patch.format !== void 0 || patch.scale !== void 0);
|
|
1752
|
+
|
|
1288
1753
|
//#endregion
|
|
1289
1754
|
//#region ../../packages/contract/src/canvas/canvas-geometry.schema.ts
|
|
1290
1755
|
const coordinate = z.number();
|
|
1291
1756
|
const dimension$1 = coordinate.nonnegative();
|
|
1292
|
-
const
|
|
1757
|
+
const MAX_ID_LENGTH = 200;
|
|
1758
|
+
const MIN_POLYGON_POINTS = 3;
|
|
1759
|
+
const identity = z.string().min(1).max(MAX_ID_LENGTH);
|
|
1293
1760
|
const path = z.string().regex(/^[MmLlHhVvCcSsQqTtAaZzEe\d\s.,+-]*$/u);
|
|
1294
1761
|
const canvasGeometryBoundsSchema = z.strictObject({
|
|
1295
1762
|
x: coordinate,
|
|
@@ -1306,6 +1773,13 @@ const canvasPathGeometrySchema = z.strictObject({
|
|
|
1306
1773
|
height: dimension$1.positive()
|
|
1307
1774
|
})
|
|
1308
1775
|
});
|
|
1776
|
+
const canvasPolygonGeometrySchema = z.strictObject({
|
|
1777
|
+
kind: z.literal("polygon"),
|
|
1778
|
+
count: z.number().int().min(MIN_POLYGON_POINTS),
|
|
1779
|
+
innerRatio: z.number().min(0).max(1).optional(),
|
|
1780
|
+
cornerRadius: dimension$1,
|
|
1781
|
+
cornerSmoothing: z.number().min(0).max(1)
|
|
1782
|
+
});
|
|
1309
1783
|
const canvasBooleanOperationSchema = z.enum([
|
|
1310
1784
|
"union",
|
|
1311
1785
|
"subtract",
|
|
@@ -1326,6 +1800,7 @@ const canvasBooleanGeometrySchema = z.strictObject({
|
|
|
1326
1800
|
});
|
|
1327
1801
|
const canvasGeometrySchema = z.discriminatedUnion("kind", [
|
|
1328
1802
|
canvasPathGeometrySchema,
|
|
1803
|
+
canvasPolygonGeometrySchema,
|
|
1329
1804
|
z.strictObject({
|
|
1330
1805
|
kind: z.literal("mask"),
|
|
1331
1806
|
maskId: identity
|
|
@@ -1335,7 +1810,7 @@ const canvasGeometrySchema = z.discriminatedUnion("kind", [
|
|
|
1335
1810
|
|
|
1336
1811
|
//#endregion
|
|
1337
1812
|
//#region ../../packages/contract/src/canvas/canvas-scene.schema.ts
|
|
1338
|
-
const canvasDocumentFormatSchema = z.literal(
|
|
1813
|
+
const canvasDocumentFormatSchema = z.literal(11, { error: "This editor uses an unsupported document format. Update the editor before changing this canvas." });
|
|
1339
1814
|
const canvasPreservedFontAppearanceSchema = z.object({
|
|
1340
1815
|
signature: z.string().regex(/^[a-f0-9]{16}$/u),
|
|
1341
1816
|
image: z.string().startsWith("data:image/jpeg;base64,"),
|
|
@@ -1361,6 +1836,7 @@ const canvasNodeConstraintsSchema = z.object({
|
|
|
1361
1836
|
const canvasNodeLabelOriginSchema = z.enum([
|
|
1362
1837
|
"source",
|
|
1363
1838
|
"generated",
|
|
1839
|
+
"content",
|
|
1364
1840
|
"user"
|
|
1365
1841
|
]);
|
|
1366
1842
|
const canvasSceneNodeSchema = z.looseObject({
|
|
@@ -1375,14 +1851,16 @@ const canvasSceneNodeSchema = z.looseObject({
|
|
|
1375
1851
|
layout: canvasNodeLayoutSchema.optional(),
|
|
1376
1852
|
responsive: z.never().optional(),
|
|
1377
1853
|
appearance: canvasAppearanceValuesSchema.optional(),
|
|
1854
|
+
exportSettings: canvasExportSettingsSchema.optional(),
|
|
1378
1855
|
typography: canvasAuthoredTypographySchema.optional(),
|
|
1379
1856
|
additionalStyles: canvasAdditionalStylesSchema.optional(),
|
|
1380
1857
|
geometry: canvasGeometrySchema.optional(),
|
|
1858
|
+
compositing: canvasCompositingSchema.optional(),
|
|
1381
1859
|
props: z.record(z.string(), z.unknown()).optional(),
|
|
1382
1860
|
box: canvasSceneBoxSchema.optional()
|
|
1383
1861
|
});
|
|
1384
1862
|
const canvasSceneDocumentSchema = z.object({
|
|
1385
|
-
version: z.literal(
|
|
1863
|
+
version: z.literal(11),
|
|
1386
1864
|
nodes: z.record(z.string(), canvasSceneNodeSchema),
|
|
1387
1865
|
relationships: z.record(z.string(), z.object({
|
|
1388
1866
|
parentId: z.string().min(1),
|
|
@@ -1399,7 +1877,7 @@ const canvasReadableSceneDocumentSchema = z.preprocess((value) => {
|
|
|
1399
1877
|
return adaptCanvasDocumentFormat(blob);
|
|
1400
1878
|
}, canvasSceneDocumentSchema);
|
|
1401
1879
|
const emptyCanvasSceneDocument = () => ({
|
|
1402
|
-
version:
|
|
1880
|
+
version: 11,
|
|
1403
1881
|
nodes: { root: {
|
|
1404
1882
|
id: "root",
|
|
1405
1883
|
label: "Canvas",
|
|
@@ -1701,10 +2179,34 @@ const getCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
|
|
|
1701
2179
|
const getCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
|
|
1702
2180
|
const cancelCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
|
|
1703
2181
|
const cancelCanvasRenderOutputSchema = z.object({ job: canvasRenderJobSchema });
|
|
2182
|
+
const canvasRenderSourceSchema = z.discriminatedUnion("status", [z.object({
|
|
2183
|
+
status: z.literal("available"),
|
|
2184
|
+
version: z.number().int().positive(),
|
|
2185
|
+
format: z.literal("enhance-scene-json"),
|
|
2186
|
+
code: z.string(),
|
|
2187
|
+
prototypes: z.array(z.object({
|
|
2188
|
+
nodeId: z.string(),
|
|
2189
|
+
prototypeId: z.uuid(),
|
|
2190
|
+
deploymentId: z.uuid(),
|
|
2191
|
+
capability: z.literal("canvas.read"),
|
|
2192
|
+
canvasPath: z.string(),
|
|
2193
|
+
input: z.object({
|
|
2194
|
+
canvasRef: z.uuid(),
|
|
2195
|
+
view: z.literal("source"),
|
|
2196
|
+
nodeId: z.string()
|
|
2197
|
+
}),
|
|
2198
|
+
guidance: z.string()
|
|
2199
|
+
})),
|
|
2200
|
+
guidance: z.string()
|
|
2201
|
+
}), z.object({
|
|
2202
|
+
status: z.literal("unavailable"),
|
|
2203
|
+
guidance: z.string()
|
|
2204
|
+
})]);
|
|
1704
2205
|
const downloadCanvasRenderInputSchema = z.object({ jobId: z.uuid() });
|
|
1705
2206
|
const downloadCanvasRenderOutputSchema = z.object({
|
|
1706
2207
|
jobId: z.uuid(),
|
|
1707
|
-
download: signedDownloadSchema
|
|
2208
|
+
download: signedDownloadSchema,
|
|
2209
|
+
source: canvasRenderSourceSchema.optional()
|
|
1708
2210
|
});
|
|
1709
2211
|
const canvasSnapshotRequestSchema = z.strictObject({
|
|
1710
2212
|
previewJobId: z.uuid(),
|
|
@@ -2051,6 +2553,26 @@ const canvasKnownNodeStylePatchSchema = canvasTextStylePatchSchema.extend(canvas
|
|
|
2051
2553
|
"flex-grow": layoutStylePatchValue,
|
|
2052
2554
|
"flex-shrink": layoutStylePatchValue,
|
|
2053
2555
|
"flex-wrap": layoutStylePatchValue,
|
|
2556
|
+
grid: layoutStylePatchValue,
|
|
2557
|
+
"grid-template": layoutStylePatchValue,
|
|
2558
|
+
"grid-template-columns": layoutStylePatchValue,
|
|
2559
|
+
"grid-template-rows": layoutStylePatchValue,
|
|
2560
|
+
"grid-template-areas": layoutStylePatchValue,
|
|
2561
|
+
"grid-auto-columns": layoutStylePatchValue,
|
|
2562
|
+
"grid-auto-rows": layoutStylePatchValue,
|
|
2563
|
+
"grid-auto-flow": layoutStylePatchValue,
|
|
2564
|
+
"grid-row": layoutStylePatchValue,
|
|
2565
|
+
"grid-column": layoutStylePatchValue,
|
|
2566
|
+
"grid-area": layoutStylePatchValue,
|
|
2567
|
+
"grid-row-start": layoutStylePatchValue,
|
|
2568
|
+
"grid-row-end": layoutStylePatchValue,
|
|
2569
|
+
"grid-column-start": layoutStylePatchValue,
|
|
2570
|
+
"grid-column-end": layoutStylePatchValue,
|
|
2571
|
+
"justify-items": layoutStylePatchValue,
|
|
2572
|
+
"justify-self": layoutStylePatchValue,
|
|
2573
|
+
"place-items": layoutStylePatchValue,
|
|
2574
|
+
"place-self": layoutStylePatchValue,
|
|
2575
|
+
"place-content": layoutStylePatchValue,
|
|
2054
2576
|
height: layoutStylePatchValue,
|
|
2055
2577
|
"inline-size": layoutStylePatchValue,
|
|
2056
2578
|
inset: layoutStylePatchValue,
|
|
@@ -2091,6 +2613,12 @@ const canvasKnownNodeStylePatchSchema = canvasTextStylePatchSchema.extend(canvas
|
|
|
2091
2613
|
width: layoutStylePatchValue,
|
|
2092
2614
|
background: z.string().nullable().optional(),
|
|
2093
2615
|
"background-color": z.string().nullable().optional(),
|
|
2616
|
+
"background-image": layoutStylePatchValue,
|
|
2617
|
+
"background-size": layoutStylePatchValue,
|
|
2618
|
+
"background-position": layoutStylePatchValue,
|
|
2619
|
+
"background-repeat": layoutStylePatchValue,
|
|
2620
|
+
"background-origin": layoutStylePatchValue,
|
|
2621
|
+
"background-blend-mode": layoutStylePatchValue,
|
|
2094
2622
|
"box-shadow": z.string().nullable().optional(),
|
|
2095
2623
|
"column-gap": dimensionalStyleValue.optional(),
|
|
2096
2624
|
gap: dimensionalStyleValue.optional(),
|
|
@@ -2120,7 +2648,8 @@ const canvasTextStepSchema = z.discriminatedUnion("kind", [
|
|
|
2120
2648
|
z.object({
|
|
2121
2649
|
kind: z.literal("retain"),
|
|
2122
2650
|
count: countSchema$1,
|
|
2123
|
-
attributes: attributesSchema.optional()
|
|
2651
|
+
attributes: attributesSchema.optional(),
|
|
2652
|
+
shouldPreserveParagraph: z.boolean().optional()
|
|
2124
2653
|
}),
|
|
2125
2654
|
z.object({
|
|
2126
2655
|
kind: z.literal("delete"),
|
|
@@ -2129,7 +2658,8 @@ const canvasTextStepSchema = z.discriminatedUnion("kind", [
|
|
|
2129
2658
|
z.object({
|
|
2130
2659
|
kind: z.literal("insert"),
|
|
2131
2660
|
text: z.string().min(1).refine((text) => text.isWellFormed()),
|
|
2132
|
-
attributes: attributesSchema.optional()
|
|
2661
|
+
attributes: attributesSchema.optional(),
|
|
2662
|
+
shouldPreserveParagraph: z.boolean().optional()
|
|
2133
2663
|
})
|
|
2134
2664
|
]);
|
|
2135
2665
|
const canvasTextChangeSchema = z.object({
|
|
@@ -2182,72 +2712,6 @@ const canvasEditTextOperationSchema = z.object({
|
|
|
2182
2712
|
source: canvasTextSourceSchema.optional()
|
|
2183
2713
|
});
|
|
2184
2714
|
|
|
2185
|
-
//#endregion
|
|
2186
|
-
//#region ../../packages/contract/src/canvas/canvas-text-style.schema.ts
|
|
2187
|
-
const MAX_DESCRIPTION$1 = 2e3;
|
|
2188
|
-
const MAX_OVERRIDE_VALUE = 1e3;
|
|
2189
|
-
const canvasTextStyleTypographySchema = canvasTypographySchema.pick({
|
|
2190
|
-
family: true,
|
|
2191
|
-
fallbackFamilies: true,
|
|
2192
|
-
size: true,
|
|
2193
|
-
weight: true,
|
|
2194
|
-
style: true,
|
|
2195
|
-
variations: true,
|
|
2196
|
-
opticalSize: true,
|
|
2197
|
-
features: true,
|
|
2198
|
-
lineHeight: true,
|
|
2199
|
-
letterSpacing: true,
|
|
2200
|
-
transform: true,
|
|
2201
|
-
decoration: true,
|
|
2202
|
-
paragraphSpacing: true,
|
|
2203
|
-
paragraphIndent: true,
|
|
2204
|
-
listSpacing: true,
|
|
2205
|
-
hangingList: true,
|
|
2206
|
-
hangingPunctuation: true,
|
|
2207
|
-
verticalTrim: true,
|
|
2208
|
-
wrapStyle: true
|
|
2209
|
-
}).strict();
|
|
2210
|
-
const CANVAS_TEXT_STYLE_PROPERTIES = canvasTextStyleTypographySchema.keyof().options;
|
|
2211
|
-
const canvasTextStyleSchema = z.object({
|
|
2212
|
-
id: z.string().min(1),
|
|
2213
|
-
name: z.string().trim().min(1),
|
|
2214
|
-
description: z.string().max(MAX_DESCRIPTION$1),
|
|
2215
|
-
sortKey: z.string().min(1).optional(),
|
|
2216
|
-
sourceStyleId: z.string().min(1).optional(),
|
|
2217
|
-
sourceCanvasId: z.uuid().optional(),
|
|
2218
|
-
sourceRevision: z.number().int().positive().optional(),
|
|
2219
|
-
typography: canvasTextStyleTypographySchema.extend({ listStyle: canvasTypographySchema.shape.listStyle }).transform((typography) => {
|
|
2220
|
-
Reflect.deleteProperty(typography, "listStyle");
|
|
2221
|
-
return typography;
|
|
2222
|
-
})
|
|
2223
|
-
}).strict().refine((style) => style.sourceCanvasId === void 0 || style.sourceStyleId !== void 0, {
|
|
2224
|
-
message: "A source canvas belongs to a reference snapshot.",
|
|
2225
|
-
path: ["sourceCanvasId"]
|
|
2226
|
-
}).refine((style) => style.sourceRevision === void 0 || style.sourceCanvasId !== void 0 && style.sourceStyleId !== void 0, {
|
|
2227
|
-
message: "A published revision belongs to a source style and canvas.",
|
|
2228
|
-
path: ["sourceRevision"]
|
|
2229
|
-
});
|
|
2230
|
-
const canvasTextStyleBindingSchema = z.object({
|
|
2231
|
-
id: canvasTextStyleSchema.shape.id,
|
|
2232
|
-
position: z.enum([
|
|
2233
|
-
"normal",
|
|
2234
|
-
"subscript",
|
|
2235
|
-
"superscript"
|
|
2236
|
-
]).optional(),
|
|
2237
|
-
overrides: z.partialRecord(z.enum([
|
|
2238
|
-
"fontWeight",
|
|
2239
|
-
"fontStyle",
|
|
2240
|
-
"fontVariationSettings",
|
|
2241
|
-
"fontOpticalSizing",
|
|
2242
|
-
"textDecorationLine",
|
|
2243
|
-
"textDecorationStyle",
|
|
2244
|
-
"textDecorationColor",
|
|
2245
|
-
"textDecorationThickness",
|
|
2246
|
-
"textUnderlineOffset",
|
|
2247
|
-
"textDecorationSkipInk"
|
|
2248
|
-
]), z.union([z.string().max(MAX_OVERRIDE_VALUE), z.number()])).optional()
|
|
2249
|
-
}).strict();
|
|
2250
|
-
|
|
2251
2715
|
//#endregion
|
|
2252
2716
|
//#region ../../packages/contract/src/canvas/text-style-library.schema.ts
|
|
2253
2717
|
const MAX_DESCRIPTION = 2e3;
|
|
@@ -2335,7 +2799,7 @@ const canvasSetStylesOperationSchema = z.object({
|
|
|
2335
2799
|
op: z.literal("setStyles"),
|
|
2336
2800
|
nodeId: nodeIdSchema$3,
|
|
2337
2801
|
styles: canvasNodeStylePatchSchema,
|
|
2338
|
-
clear: z.array(canvasRestorableStylePropertySchema).min(1).
|
|
2802
|
+
clear: z.array(canvasRestorableStylePropertySchema).min(1).refine((properties) => new Set(properties).size === properties.length).optional()
|
|
2339
2803
|
}).refine((operation) => (operation.clear ?? []).every((property) => !Object.hasOwn(operation.styles, property)));
|
|
2340
2804
|
const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
2341
2805
|
insertConvertedSubtreeOperationSchema,
|
|
@@ -2415,6 +2879,11 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2415
2879
|
constraints: canvasNodeConstraintsSchema.nullable()
|
|
2416
2880
|
}),
|
|
2417
2881
|
canvasSetStylesOperationSchema,
|
|
2882
|
+
z.object({
|
|
2883
|
+
op: z.literal("patchExportSettings"),
|
|
2884
|
+
nodeId: nodeIdSchema$3,
|
|
2885
|
+
exportSettings: canvasExportSettingsPatchSchema
|
|
2886
|
+
}),
|
|
2418
2887
|
z.object({
|
|
2419
2888
|
op: z.literal("setAppearance"),
|
|
2420
2889
|
nodeId: nodeIdSchema$3,
|
|
@@ -2423,7 +2892,8 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2423
2892
|
z.object({
|
|
2424
2893
|
op: z.literal("setLayout"),
|
|
2425
2894
|
nodeId: nodeIdSchema$3,
|
|
2426
|
-
layout: z.union([canvasNodeLayoutSchema, z.literal("default")])
|
|
2895
|
+
layout: z.union([canvasNodeLayoutSchema, z.literal("default")]),
|
|
2896
|
+
fields: z.array(canvasNodeLayoutSchema.keyof()).optional()
|
|
2427
2897
|
}),
|
|
2428
2898
|
z.object({
|
|
2429
2899
|
op: z.literal("patchTypography"),
|
|
@@ -2445,6 +2915,7 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2445
2915
|
nodeId: nodeIdSchema$3,
|
|
2446
2916
|
additionalStyles: z.union([canvasAdditionalStylesSchema, z.literal("default")])
|
|
2447
2917
|
}),
|
|
2918
|
+
setCanvasArtworkColorOperationSchema,
|
|
2448
2919
|
z.object({
|
|
2449
2920
|
op: z.literal("setTextStyleLibrary"),
|
|
2450
2921
|
nodeId: z.literal("root"),
|
|
@@ -2466,7 +2937,12 @@ const canvasOperationSchema = z.discriminatedUnion("op", [
|
|
|
2466
2937
|
z.object({
|
|
2467
2938
|
op: z.literal("setGeometry"),
|
|
2468
2939
|
nodeId: nodeIdSchema$3,
|
|
2469
|
-
geometry: z.union([canvasGeometrySchema, z.literal("default")])
|
|
2940
|
+
geometry: z.union([canvasGeometrySchema, z.literal("default")])
|
|
2941
|
+
}),
|
|
2942
|
+
z.object({
|
|
2943
|
+
op: z.literal("setCompositing"),
|
|
2944
|
+
nodeId: nodeIdSchema$3,
|
|
2945
|
+
compositing: z.union([canvasCompositingSchema, z.literal("default")])
|
|
2470
2946
|
}),
|
|
2471
2947
|
z.object({
|
|
2472
2948
|
op: z.literal("setProps"),
|
|
@@ -2518,7 +2994,7 @@ const documentScreenSchema = z.object({
|
|
|
2518
2994
|
sourceUrl: z.string(),
|
|
2519
2995
|
assets: z.array(z.object({
|
|
2520
2996
|
url: z.string(),
|
|
2521
|
-
contentType: z.string()
|
|
2997
|
+
contentType: z.string(),
|
|
2522
2998
|
path: z.string().startsWith("/v1/recording-assets/")
|
|
2523
2999
|
})),
|
|
2524
3000
|
missingAssetCount: z.number().int().min(0)
|
|
@@ -2595,221 +3071,6 @@ const mapCanvasFontSources = (props, map) => {
|
|
|
2595
3071
|
};
|
|
2596
3072
|
};
|
|
2597
3073
|
|
|
2598
|
-
//#endregion
|
|
2599
|
-
//#region ../../packages/contract/src/canvas/canvas-rich-text.consts.ts
|
|
2600
|
-
const CANVAS_RICH_TEXT_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
|
|
2601
|
-
"alignItems",
|
|
2602
|
-
"backgroundColor",
|
|
2603
|
-
"borderBottom",
|
|
2604
|
-
"borderBottomLeftRadius",
|
|
2605
|
-
"borderBottomRightRadius",
|
|
2606
|
-
"borderLeft",
|
|
2607
|
-
"borderRight",
|
|
2608
|
-
"borderTop",
|
|
2609
|
-
"borderTopLeftRadius",
|
|
2610
|
-
"borderTopRightRadius",
|
|
2611
|
-
"boxShadow",
|
|
2612
|
-
"boxSizing",
|
|
2613
|
-
"color",
|
|
2614
|
-
"columnGap",
|
|
2615
|
-
"display",
|
|
2616
|
-
"flexDirection",
|
|
2617
|
-
"fontFamily",
|
|
2618
|
-
"fontFeatureSettings",
|
|
2619
|
-
"fontOpticalSizing",
|
|
2620
|
-
"fontSize",
|
|
2621
|
-
"fontStretch",
|
|
2622
|
-
"fontStyle",
|
|
2623
|
-
"fontVariant",
|
|
2624
|
-
"fontVariantCaps",
|
|
2625
|
-
"fontVariantLigatures",
|
|
2626
|
-
"fontVariantNumeric",
|
|
2627
|
-
"fontVariantPosition",
|
|
2628
|
-
"fontKerning",
|
|
2629
|
-
"fontVariationSettings",
|
|
2630
|
-
"fontWeight",
|
|
2631
|
-
"justifyContent",
|
|
2632
|
-
"letterSpacing",
|
|
2633
|
-
"lineHeight",
|
|
2634
|
-
"marginBottom",
|
|
2635
|
-
"marginLeft",
|
|
2636
|
-
"marginRight",
|
|
2637
|
-
"marginTop",
|
|
2638
|
-
"opacity",
|
|
2639
|
-
"paddingBottom",
|
|
2640
|
-
"paddingLeft",
|
|
2641
|
-
"paddingRight",
|
|
2642
|
-
"paddingTop",
|
|
2643
|
-
"rowGap",
|
|
2644
|
-
"textDecorationColor",
|
|
2645
|
-
"textDecorationLine",
|
|
2646
|
-
"textDecorationSkipInk",
|
|
2647
|
-
"textDecorationStyle",
|
|
2648
|
-
"textDecorationThickness",
|
|
2649
|
-
"textShadow",
|
|
2650
|
-
"textTransform",
|
|
2651
|
-
"textUnderlineOffset",
|
|
2652
|
-
"verticalAlign",
|
|
2653
|
-
"whiteSpace",
|
|
2654
|
-
"WebkitTextStrokeColor",
|
|
2655
|
-
"WebkitTextStrokeWidth",
|
|
2656
|
-
"--canvas-text-stroke-alignment"
|
|
2657
|
-
]);
|
|
2658
|
-
|
|
2659
|
-
//#endregion
|
|
2660
|
-
//#region ../../packages/contract/src/canvas/canvas-rich-text.lib.ts
|
|
2661
|
-
const fillsSchema = canvasPaintSchema.array().optional();
|
|
2662
|
-
const characterFormattingSchema = canvasTextParagraphSchema.pick({
|
|
2663
|
-
paragraphSpacing: true,
|
|
2664
|
-
paragraphIndent: true,
|
|
2665
|
-
listSpacing: true,
|
|
2666
|
-
wrapStyle: true
|
|
2667
|
-
}).extend({
|
|
2668
|
-
hangingPunctuation: canvasTypographySchema.shape.hangingPunctuation,
|
|
2669
|
-
verticalTrim: canvasTypographySchema.shape.verticalTrim
|
|
2670
|
-
}).strip();
|
|
2671
|
-
const SAFE_HREF_PROTOCOLS = /* @__PURE__ */ new Set([
|
|
2672
|
-
"http:",
|
|
2673
|
-
"https:",
|
|
2674
|
-
"mailto:",
|
|
2675
|
-
"tel:"
|
|
2676
|
-
]);
|
|
2677
|
-
const isCanvasRichTextHref = (value) => {
|
|
2678
|
-
const href = value.trim();
|
|
2679
|
-
if (href === "") return false;
|
|
2680
|
-
try {
|
|
2681
|
-
const protocol = new URL(href, "https://enhance.invalid/").protocol;
|
|
2682
|
-
return SAFE_HREF_PROTOCOLS.has(protocol);
|
|
2683
|
-
} catch {
|
|
2684
|
-
return false;
|
|
2685
|
-
}
|
|
2686
|
-
};
|
|
2687
|
-
const safeHref = (value) => typeof value === "string" && isCanvasRichTextHref(value) ? value : void 0;
|
|
2688
|
-
const richStylesOf = (value) => {
|
|
2689
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
2690
|
-
const entries = Object.entries(value);
|
|
2691
|
-
if (entries.some(([property, styleValue]) => !CANVAS_RICH_TEXT_STYLE_PROPERTIES.has(property) || typeof styleValue !== "string" && typeof styleValue !== "number")) return null;
|
|
2692
|
-
return Object.fromEntries(entries);
|
|
2693
|
-
};
|
|
2694
|
-
const richMetadataOf = (value) => {
|
|
2695
|
-
const sourcePath = Reflect.get(value, "sourcePath");
|
|
2696
|
-
return {
|
|
2697
|
-
...Object.fromEntries(Object.entries(value).filter(([key]) => ![
|
|
2698
|
-
"text",
|
|
2699
|
-
"href",
|
|
2700
|
-
"sourcePath",
|
|
2701
|
-
"styles",
|
|
2702
|
-
"fills",
|
|
2703
|
-
"paragraph",
|
|
2704
|
-
"paragraphSpacing",
|
|
2705
|
-
"paragraphIndent",
|
|
2706
|
-
"listSpacing",
|
|
2707
|
-
"hangingPunctuation",
|
|
2708
|
-
"verticalTrim",
|
|
2709
|
-
"wrapStyle",
|
|
2710
|
-
"soft",
|
|
2711
|
-
"textStyle"
|
|
2712
|
-
].includes(key))),
|
|
2713
|
-
...typeof sourcePath === "string" && { sourcePath }
|
|
2714
|
-
};
|
|
2715
|
-
};
|
|
2716
|
-
const richChildrenOf = (values) => {
|
|
2717
|
-
const result = [];
|
|
2718
|
-
const pending = values.toReversed().map((value) => ({
|
|
2719
|
-
value,
|
|
2720
|
-
target: result
|
|
2721
|
-
}));
|
|
2722
|
-
const ancestors = /* @__PURE__ */ new Set();
|
|
2723
|
-
while (pending.length > 0) {
|
|
2724
|
-
const task = pending.pop();
|
|
2725
|
-
if (task === void 0) continue;
|
|
2726
|
-
if ("done" in task) {
|
|
2727
|
-
ancestors.delete(task.done);
|
|
2728
|
-
continue;
|
|
2729
|
-
}
|
|
2730
|
-
const children = [];
|
|
2731
|
-
const node = richNodeOf(task.value, children);
|
|
2732
|
-
if (node === null) return null;
|
|
2733
|
-
task.target.push(node);
|
|
2734
|
-
if (node.kind !== "span") continue;
|
|
2735
|
-
const value = task.value;
|
|
2736
|
-
if (typeof value !== "object" || value === null || ancestors.has(value)) return null;
|
|
2737
|
-
ancestors.add(value);
|
|
2738
|
-
pending.push({ done: value });
|
|
2739
|
-
const nested = Reflect.get(value, "children");
|
|
2740
|
-
if (!Array.isArray(nested)) return null;
|
|
2741
|
-
const candidates = nested;
|
|
2742
|
-
for (const child of candidates.toReversed()) pending.push({
|
|
2743
|
-
value: child,
|
|
2744
|
-
target: children
|
|
2745
|
-
});
|
|
2746
|
-
}
|
|
2747
|
-
return result;
|
|
2748
|
-
};
|
|
2749
|
-
const richBreakOf = (value) => {
|
|
2750
|
-
const soft = Reflect.get(value, "soft");
|
|
2751
|
-
if (soft !== void 0 && soft !== true) return null;
|
|
2752
|
-
return {
|
|
2753
|
-
...richMetadataOf(value),
|
|
2754
|
-
kind: "break",
|
|
2755
|
-
...soft === true && { soft }
|
|
2756
|
-
};
|
|
2757
|
-
};
|
|
2758
|
-
const richNodeOf = (value, children) => {
|
|
2759
|
-
if (typeof value !== "object" || value === null) return null;
|
|
2760
|
-
const kind = Reflect.get(value, "kind");
|
|
2761
|
-
const metadata = richMetadataOf(value);
|
|
2762
|
-
if (kind === "break") return richBreakOf(value);
|
|
2763
|
-
if (kind === "text") {
|
|
2764
|
-
const text = Reflect.get(value, "text");
|
|
2765
|
-
return typeof text === "string" ? {
|
|
2766
|
-
...metadata,
|
|
2767
|
-
kind,
|
|
2768
|
-
text
|
|
2769
|
-
} : null;
|
|
2770
|
-
}
|
|
2771
|
-
if (kind !== "span") return null;
|
|
2772
|
-
const values = Reflect.get(value, "children");
|
|
2773
|
-
const styles = richStylesOf(Reflect.get(value, "styles"));
|
|
2774
|
-
const fills = fillsSchema.safeParse(Reflect.get(value, "fills"));
|
|
2775
|
-
const paragraph = canvasTextParagraphSchema.optional().safeParse(Reflect.get(value, "paragraph"));
|
|
2776
|
-
const formatting = characterFormattingSchema.safeParse(value);
|
|
2777
|
-
const textStyle = canvasTextStyleBindingSchema.optional().safeParse(Reflect.get(value, "textStyle"));
|
|
2778
|
-
if (styles === null || !fills.success || !paragraph.success || !formatting.success || !textStyle.success || !Array.isArray(values)) return null;
|
|
2779
|
-
const href = safeHref(Reflect.get(value, "href"));
|
|
2780
|
-
return {
|
|
2781
|
-
...metadata,
|
|
2782
|
-
kind,
|
|
2783
|
-
styles,
|
|
2784
|
-
children,
|
|
2785
|
-
...textStyle.data !== void 0 && { textStyle: textStyle.data },
|
|
2786
|
-
...fills.data !== void 0 && { fills: fills.data },
|
|
2787
|
-
...paragraph.data !== void 0 && { paragraph: paragraph.data },
|
|
2788
|
-
...Object.fromEntries(Object.entries(formatting.data).filter(([, entry]) => entry !== void 0)),
|
|
2789
|
-
...href !== void 0 && { href }
|
|
2790
|
-
};
|
|
2791
|
-
};
|
|
2792
|
-
const richTextLeafValue = (node) => node.kind === "text" ? node.text : node.soft === true ? "\u2028" : "\n";
|
|
2793
|
-
const canvasRichTextValueOf = (nodes) => {
|
|
2794
|
-
const pending = nodes.toReversed();
|
|
2795
|
-
const text = [];
|
|
2796
|
-
while (pending.length > 0) {
|
|
2797
|
-
const node = pending.pop();
|
|
2798
|
-
if (node === void 0) break;
|
|
2799
|
-
if (node.kind === "span") for (const child of node.children.toReversed()) pending.push(child);
|
|
2800
|
-
else text.push(richTextLeafValue(node));
|
|
2801
|
-
}
|
|
2802
|
-
return text.join("");
|
|
2803
|
-
};
|
|
2804
|
-
const canvasRichTextOf = (node) => {
|
|
2805
|
-
const props = node.props;
|
|
2806
|
-
if (props === void 0 || !Array.isArray(props["richText"])) return [];
|
|
2807
|
-
const rich = richChildrenOf(props["richText"]);
|
|
2808
|
-
if (rich === null) return [];
|
|
2809
|
-
const text = props["text"];
|
|
2810
|
-
return canvasRichTextValueOf(rich) === text ? rich : [];
|
|
2811
|
-
};
|
|
2812
|
-
|
|
2813
3074
|
//#endregion
|
|
2814
3075
|
//#region ../../packages/contract/src/canvas/canvas-text-content.lib.ts
|
|
2815
3076
|
const textLinkSchema = z.object({
|
|
@@ -2904,6 +3165,8 @@ const inspectCanvasNodeOutputSchema = z.object({
|
|
|
2904
3165
|
styles: z.record(z.string(), z.union([z.string(), z.number()])),
|
|
2905
3166
|
layout: canvasNodeLayoutSchema.optional(),
|
|
2906
3167
|
appearance: canvasAppearanceValuesSchema.optional(),
|
|
3168
|
+
compositing: canvasCompositingSchema.optional(),
|
|
3169
|
+
geometry: canvasGeometrySchema.optional(),
|
|
2907
3170
|
typography: canvasAuthoredTypographySchema.optional(),
|
|
2908
3171
|
additionalStyles: canvasAdditionalStylesSchema.optional(),
|
|
2909
3172
|
props: z.record(z.string(), z.unknown()),
|
|
@@ -2942,14 +3205,26 @@ const releasedSpacing = (held, prefix, properties) => {
|
|
|
2942
3205
|
for (const side of SIDES) if (properties.has(`${prefix}-${side}`)) Reflect.deleteProperty(next, side);
|
|
2943
3206
|
return next;
|
|
2944
3207
|
};
|
|
3208
|
+
const releasedGridPolicy = (held, properties) => {
|
|
3209
|
+
const layout = { ...held };
|
|
3210
|
+
if (properties.has("display") || properties.has("grid-auto-flow")) Reflect.deleteProperty(layout, "gridEmptyPlacement");
|
|
3211
|
+
if (layout.gridAutoTrackPolicy === void 0) return layout;
|
|
3212
|
+
const policy = { ...layout.gridAutoTrackPolicy };
|
|
3213
|
+
for (const axis of ["columns", "rows"]) if (properties.has("display") || properties.has(`grid-auto-${axis}`) || properties.has(`grid-template-${axis}`)) Reflect.deleteProperty(policy, axis);
|
|
3214
|
+
if (Object.keys(policy).length === 0) Reflect.deleteProperty(layout, "gridAutoTrackPolicy");
|
|
3215
|
+
else layout.gridAutoTrackPolicy = policy;
|
|
3216
|
+
return layout;
|
|
3217
|
+
};
|
|
2945
3218
|
/** A shorthand can release several named controls; a longhand releases only itself. */
|
|
2946
3219
|
const releasedFields = (held, changed) => {
|
|
2947
3220
|
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
2948
|
-
const layout =
|
|
3221
|
+
const layout = releasedGridPolicy(held, properties);
|
|
2949
3222
|
for (const [key, property] of CANVAS_LAYOUT_CSS_FIELDS) if (properties.has(property)) Reflect.deleteProperty(layout, key);
|
|
2950
3223
|
if (layout.margin !== void 0) layout.margin = releasedSpacing(layout.margin, "margin", properties);
|
|
2951
3224
|
if (layout.container === void 0) return layout;
|
|
2952
3225
|
const container = { ...layout.container };
|
|
3226
|
+
const crossProperty = container.direction === "column" ? "column-gap" : "row-gap";
|
|
3227
|
+
if (properties.has(crossProperty) || properties.has("display")) Reflect.deleteProperty(container, "crossGapMode");
|
|
2953
3228
|
if ((properties.has("row-gap") || properties.has("column-gap")) && container.gap !== void 0) {
|
|
2954
3229
|
container.rowGap ??= container.gap;
|
|
2955
3230
|
container.columnGap ??= container.gap;
|
|
@@ -2978,12 +3253,17 @@ const axisWithoutCssBounds = (intent, properties, changed) => {
|
|
|
2978
3253
|
const canvasLayoutWithoutCssProperties = (held, changed, axes) => {
|
|
2979
3254
|
const properties = new Set([...changed].flatMap((property) => canvasCssPropertyScope(property)));
|
|
2980
3255
|
const layout = releasedFields(held, properties);
|
|
3256
|
+
if (properties.has("display")) Reflect.deleteProperty(layout, "retainedFlexSpacing");
|
|
2981
3257
|
if ([
|
|
2982
3258
|
"overflow",
|
|
2983
3259
|
"overflow-x",
|
|
2984
3260
|
"overflow-y"
|
|
2985
3261
|
].some((property) => properties.has(property))) Reflect.deleteProperty(layout, "clipContent");
|
|
2986
|
-
if (properties.has("position"))
|
|
3262
|
+
if (properties.has("position")) {
|
|
3263
|
+
Reflect.deleteProperty(layout, "position");
|
|
3264
|
+
Reflect.deleteProperty(layout, "retainedIgnore");
|
|
3265
|
+
Reflect.deleteProperty(layout, "gridParticipation");
|
|
3266
|
+
}
|
|
2987
3267
|
if (properties.has("transform")) for (const key of [
|
|
2988
3268
|
"rotation",
|
|
2989
3269
|
"flipHorizontal",
|
|
@@ -3092,6 +3372,7 @@ const GROUP_KIND = "group";
|
|
|
3092
3372
|
const RECTANGLE_KIND = "rectangle";
|
|
3093
3373
|
const IMAGE_KIND = "image";
|
|
3094
3374
|
const SVG_KIND = "svg";
|
|
3375
|
+
const BOOLEAN_KIND = "boolean";
|
|
3095
3376
|
const RECORDING_KIND = "recording";
|
|
3096
3377
|
const PROTOTYPE_KIND = "prototype";
|
|
3097
3378
|
const TEXT_KIND = "text";
|
|
@@ -3230,6 +3511,7 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
3230
3511
|
"position",
|
|
3231
3512
|
"layout",
|
|
3232
3513
|
"blending",
|
|
3514
|
+
"filters",
|
|
3233
3515
|
"additionalStyles",
|
|
3234
3516
|
"export"
|
|
3235
3517
|
]
|
|
@@ -3289,6 +3571,25 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
3289
3571
|
},
|
|
3290
3572
|
propertySections: SVG_PROPERTY_SECTIONS
|
|
3291
3573
|
},
|
|
3574
|
+
{
|
|
3575
|
+
objectKind: BOOLEAN_KIND,
|
|
3576
|
+
label: "Boolean",
|
|
3577
|
+
category: "container",
|
|
3578
|
+
capabilities: {
|
|
3579
|
+
canSelect: true,
|
|
3580
|
+
canContainChildren: true,
|
|
3581
|
+
canEditProperties: true,
|
|
3582
|
+
commentAnchor: "node"
|
|
3583
|
+
},
|
|
3584
|
+
capture: { preservesVectorData: true },
|
|
3585
|
+
selectionBehavior: { hitTarget: "frame" },
|
|
3586
|
+
resizeBehavior: {
|
|
3587
|
+
mode: "scale",
|
|
3588
|
+
preservesAspect: false,
|
|
3589
|
+
canLockAspectRatio: true
|
|
3590
|
+
},
|
|
3591
|
+
propertySections: SVG_PROPERTY_SECTIONS
|
|
3592
|
+
},
|
|
3292
3593
|
{
|
|
3293
3594
|
objectKind: RECORDING_KIND,
|
|
3294
3595
|
label: "Recording",
|
|
@@ -3338,9 +3639,83 @@ const DESCRIPTOR_BY_KIND = Object.fromEntries([
|
|
|
3338
3639
|
"export"
|
|
3339
3640
|
]
|
|
3340
3641
|
}
|
|
3341
|
-
].map((descriptor) => [descriptor.objectKind, descriptor]));
|
|
3342
|
-
const canvasObjectKindDescriptor = (objectKind) => DESCRIPTOR_BY_KIND[objectKind] ?? null;
|
|
3343
|
-
const canvasPropertySectionsForKind = (objectKind) => canvasObjectKindDescriptor(objectKind)?.propertySections ?? [];
|
|
3642
|
+
].map((descriptor) => [descriptor.objectKind, descriptor]));
|
|
3643
|
+
const canvasObjectKindDescriptor = (objectKind) => DESCRIPTOR_BY_KIND[objectKind] ?? null;
|
|
3644
|
+
const canvasPropertySectionsForKind = (objectKind) => canvasObjectKindDescriptor(objectKind)?.propertySections ?? [];
|
|
3645
|
+
|
|
3646
|
+
//#endregion
|
|
3647
|
+
//#region ../../packages/contract/src/canvas/canvas-reference-scope.lib.ts
|
|
3648
|
+
const ROOT_ID = "root";
|
|
3649
|
+
const DEFAULT_CANVAS_REFERENCE_PAGE_ID = "canvas-page-default";
|
|
3650
|
+
const rootIdsOf = (document) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === ROOT_ID).toSorted(([firstId, first], [secondId, second]) => first.sortKey === second.sortKey ? firstId.localeCompare(secondId) : first.sortKey < second.sortKey ? -1 : 1).map(([id]) => id);
|
|
3651
|
+
const canvasReferencePageIds = (document) => {
|
|
3652
|
+
const pages = rootIdsOf(document).filter((id) => document.nodes[id]?.component === PAGE_KIND);
|
|
3653
|
+
return pages.length > 0 ? pages : [DEFAULT_CANVAS_REFERENCE_PAGE_ID];
|
|
3654
|
+
};
|
|
3655
|
+
const canvasReferencePageOf = (document, nodeId) => {
|
|
3656
|
+
const visited = /* @__PURE__ */ new Set();
|
|
3657
|
+
let currentId = nodeId;
|
|
3658
|
+
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
3659
|
+
visited.add(currentId);
|
|
3660
|
+
const node = document.nodes[currentId];
|
|
3661
|
+
if (node === void 0 || node.component === "page") return null;
|
|
3662
|
+
const parentId = document.relationships[currentId]?.parentId;
|
|
3663
|
+
if (parentId === ROOT_ID) {
|
|
3664
|
+
const assigned = node.props?.["canvasPageId"];
|
|
3665
|
+
return typeof assigned === "string" ? assigned : DEFAULT_CANVAS_REFERENCE_PAGE_ID;
|
|
3666
|
+
}
|
|
3667
|
+
currentId = parentId;
|
|
3668
|
+
}
|
|
3669
|
+
return null;
|
|
3670
|
+
};
|
|
3671
|
+
const descendantsOf = (document, rootIds) => {
|
|
3672
|
+
const children = /* @__PURE__ */ new Map();
|
|
3673
|
+
for (const [id, relation] of Object.entries(document.relationships)) {
|
|
3674
|
+
const siblings = children.get(relation.parentId) ?? [];
|
|
3675
|
+
siblings.push(id);
|
|
3676
|
+
children.set(relation.parentId, siblings);
|
|
3677
|
+
}
|
|
3678
|
+
const result = /* @__PURE__ */ new Set();
|
|
3679
|
+
const pending = [...rootIds];
|
|
3680
|
+
while (pending.length > 0) {
|
|
3681
|
+
const id = pending.pop();
|
|
3682
|
+
if (id === void 0 || result.has(id) || document.nodes[id] === void 0) continue;
|
|
3683
|
+
result.add(id);
|
|
3684
|
+
pending.push(...children.get(id) ?? []);
|
|
3685
|
+
}
|
|
3686
|
+
return result;
|
|
3687
|
+
};
|
|
3688
|
+
const resolveCanvasReference = (reference, document) => {
|
|
3689
|
+
const pages = canvasReferencePageIds(document);
|
|
3690
|
+
if (reference.pageId !== void 0 && !pages.includes(reference.pageId)) return {
|
|
3691
|
+
ok: false,
|
|
3692
|
+
reason: "page"
|
|
3693
|
+
};
|
|
3694
|
+
const selectionPages = reference.nodeIds.map((id) => canvasReferencePageOf(document, id));
|
|
3695
|
+
if (selectionPages.some((pageId) => pageId === null || !pages.includes(pageId))) return {
|
|
3696
|
+
ok: false,
|
|
3697
|
+
reason: "selection"
|
|
3698
|
+
};
|
|
3699
|
+
if (reference.pageId !== void 0 && selectionPages.some((pageId) => pageId !== reference.pageId)) return {
|
|
3700
|
+
ok: false,
|
|
3701
|
+
reason: "inconsistent-page"
|
|
3702
|
+
};
|
|
3703
|
+
if (new Set(selectionPages).size > 1) return {
|
|
3704
|
+
ok: false,
|
|
3705
|
+
reason: "mixed-pages"
|
|
3706
|
+
};
|
|
3707
|
+
const pageId = reference.pageId ?? selectionPages[0] ?? null;
|
|
3708
|
+
const rootNodeIds = reference.nodeIds.length > 0 ? [...new Set(reference.nodeIds)] : rootIdsOf(document).filter((id) => {
|
|
3709
|
+
const ownedPage = canvasReferencePageOf(document, id);
|
|
3710
|
+
return ownedPage !== null && (pageId === null || ownedPage === pageId);
|
|
3711
|
+
});
|
|
3712
|
+
return {
|
|
3713
|
+
ok: true,
|
|
3714
|
+
pageId,
|
|
3715
|
+
rootNodeIds,
|
|
3716
|
+
nodeIds: descendantsOf(document, rootNodeIds)
|
|
3717
|
+
};
|
|
3718
|
+
};
|
|
3344
3719
|
|
|
3345
3720
|
//#endregion
|
|
3346
3721
|
//#region ../../packages/contract/src/canvas/canvas-preparation.schema.ts
|
|
@@ -3726,6 +4101,21 @@ const serverEnvelopeBase = {
|
|
|
3726
4101
|
seq: z.number().int().nonnegative()
|
|
3727
4102
|
};
|
|
3728
4103
|
const canvasRealtimeServerEnvelopeSchema = z.discriminatedUnion("type", [
|
|
4104
|
+
z.object({
|
|
4105
|
+
...serverEnvelopeBase,
|
|
4106
|
+
type: z.literal("access.changed"),
|
|
4107
|
+
payload: z.object({})
|
|
4108
|
+
}),
|
|
4109
|
+
z.object({
|
|
4110
|
+
...serverEnvelopeBase,
|
|
4111
|
+
type: z.literal("comments.changed"),
|
|
4112
|
+
payload: z.object({ threadId: z.uuid() })
|
|
4113
|
+
}),
|
|
4114
|
+
z.object({
|
|
4115
|
+
...serverEnvelopeBase,
|
|
4116
|
+
type: z.literal("resources.changed"),
|
|
4117
|
+
payload: z.object({})
|
|
4118
|
+
}),
|
|
3729
4119
|
z.object({
|
|
3730
4120
|
...serverEnvelopeBase,
|
|
3731
4121
|
type: z.literal("room.snapshot"),
|
|
@@ -3921,80 +4311,6 @@ const buildCanvasReference = (origin, reference) => {
|
|
|
3921
4311
|
} : read;
|
|
3922
4312
|
};
|
|
3923
4313
|
|
|
3924
|
-
//#endregion
|
|
3925
|
-
//#region ../../packages/contract/src/canvas/canvas-reference-scope.lib.ts
|
|
3926
|
-
const ROOT_ID = "root";
|
|
3927
|
-
const DEFAULT_CANVAS_REFERENCE_PAGE_ID = "canvas-page-default";
|
|
3928
|
-
const rootIdsOf = (document) => Object.entries(document.relationships).filter(([, relationship]) => relationship.parentId === ROOT_ID).toSorted(([firstId, first], [secondId, second]) => first.sortKey === second.sortKey ? firstId.localeCompare(secondId) : first.sortKey < second.sortKey ? -1 : 1).map(([id]) => id);
|
|
3929
|
-
const canvasReferencePageIds = (document) => {
|
|
3930
|
-
const pages = rootIdsOf(document).filter((id) => document.nodes[id]?.component === PAGE_KIND);
|
|
3931
|
-
return pages.length > 0 ? pages : [DEFAULT_CANVAS_REFERENCE_PAGE_ID];
|
|
3932
|
-
};
|
|
3933
|
-
const canvasReferencePageOf = (document, nodeId) => {
|
|
3934
|
-
const visited = /* @__PURE__ */ new Set();
|
|
3935
|
-
let currentId = nodeId;
|
|
3936
|
-
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
3937
|
-
visited.add(currentId);
|
|
3938
|
-
const node = document.nodes[currentId];
|
|
3939
|
-
if (node === void 0 || node.component === "page") return null;
|
|
3940
|
-
const parentId = document.relationships[currentId]?.parentId;
|
|
3941
|
-
if (parentId === ROOT_ID) {
|
|
3942
|
-
const assigned = node.props?.["canvasPageId"];
|
|
3943
|
-
return typeof assigned === "string" ? assigned : DEFAULT_CANVAS_REFERENCE_PAGE_ID;
|
|
3944
|
-
}
|
|
3945
|
-
currentId = parentId;
|
|
3946
|
-
}
|
|
3947
|
-
return null;
|
|
3948
|
-
};
|
|
3949
|
-
const descendantsOf = (document, rootIds) => {
|
|
3950
|
-
const children = /* @__PURE__ */ new Map();
|
|
3951
|
-
for (const [id, relation] of Object.entries(document.relationships)) {
|
|
3952
|
-
const siblings = children.get(relation.parentId) ?? [];
|
|
3953
|
-
siblings.push(id);
|
|
3954
|
-
children.set(relation.parentId, siblings);
|
|
3955
|
-
}
|
|
3956
|
-
const result = /* @__PURE__ */ new Set();
|
|
3957
|
-
const pending = [...rootIds];
|
|
3958
|
-
while (pending.length > 0) {
|
|
3959
|
-
const id = pending.pop();
|
|
3960
|
-
if (id === void 0 || result.has(id) || document.nodes[id] === void 0) continue;
|
|
3961
|
-
result.add(id);
|
|
3962
|
-
pending.push(...children.get(id) ?? []);
|
|
3963
|
-
}
|
|
3964
|
-
return result;
|
|
3965
|
-
};
|
|
3966
|
-
const resolveCanvasReference = (reference, document) => {
|
|
3967
|
-
const pages = canvasReferencePageIds(document);
|
|
3968
|
-
if (reference.pageId !== void 0 && !pages.includes(reference.pageId)) return {
|
|
3969
|
-
ok: false,
|
|
3970
|
-
reason: "page"
|
|
3971
|
-
};
|
|
3972
|
-
const selectionPages = reference.nodeIds.map((id) => canvasReferencePageOf(document, id));
|
|
3973
|
-
if (selectionPages.some((pageId) => pageId === null || !pages.includes(pageId))) return {
|
|
3974
|
-
ok: false,
|
|
3975
|
-
reason: "selection"
|
|
3976
|
-
};
|
|
3977
|
-
if (reference.pageId !== void 0 && selectionPages.some((pageId) => pageId !== reference.pageId)) return {
|
|
3978
|
-
ok: false,
|
|
3979
|
-
reason: "inconsistent-page"
|
|
3980
|
-
};
|
|
3981
|
-
if (new Set(selectionPages).size > 1) return {
|
|
3982
|
-
ok: false,
|
|
3983
|
-
reason: "mixed-pages"
|
|
3984
|
-
};
|
|
3985
|
-
const pageId = reference.pageId ?? selectionPages[0] ?? null;
|
|
3986
|
-
const rootNodeIds = reference.nodeIds.length > 0 ? [...new Set(reference.nodeIds)] : rootIdsOf(document).filter((id) => {
|
|
3987
|
-
const ownedPage = canvasReferencePageOf(document, id);
|
|
3988
|
-
return ownedPage !== null && (pageId === null || ownedPage === pageId);
|
|
3989
|
-
});
|
|
3990
|
-
return {
|
|
3991
|
-
ok: true,
|
|
3992
|
-
pageId,
|
|
3993
|
-
rootNodeIds,
|
|
3994
|
-
nodeIds: descendantsOf(document, rootNodeIds)
|
|
3995
|
-
};
|
|
3996
|
-
};
|
|
3997
|
-
|
|
3998
4314
|
//#endregion
|
|
3999
4315
|
//#region ../../packages/contract/src/canvas/canvas-render-exposure.schema.ts
|
|
4000
4316
|
/** The only job metadata exposed to the browser carrying a one-job render grant. */
|
|
@@ -4251,6 +4567,7 @@ const canvasCaptureSchema = z.object({
|
|
|
4251
4567
|
}),
|
|
4252
4568
|
atMs: z.number(),
|
|
4253
4569
|
screenId: z.string().nullable().default(null),
|
|
4570
|
+
sourceNodeId: z.string().optional(),
|
|
4254
4571
|
provenance: canvasCaptureProvenanceSchema.optional()
|
|
4255
4572
|
});
|
|
4256
4573
|
const canvasConversionMetadataSchema = z.object({
|
|
@@ -4514,6 +4831,7 @@ const STYLE_PROPERTIES = new Set(CANVAS_TEXT_STYLE_PROPERTIES);
|
|
|
4514
4831
|
const STYLE_CSS = new Set(Object.entries(CANVAS_TYPOGRAPHY_CSS_OWNERS).flatMap(([css, owners]) => owners.some((owner) => STYLE_PROPERTIES.has(owner)) ? [css.replaceAll(/-([a-z])/gu, (_, letter) => letter.toUpperCase())] : []));
|
|
4515
4832
|
const canvasTextBindingWithFormatting = (binding, styles, shouldOverride = false, options = {}) => {
|
|
4516
4833
|
if (binding === null || options.paragraphSpacing !== void 0 || options.paragraphIndent !== void 0 || options.listSpacing !== void 0 || options.hangingPunctuation !== void 0 || options.verticalTrim !== void 0 || options.wrapStyle !== void 0) return null;
|
|
4834
|
+
if (Object.keys(styles).every((key) => !STYLE_CSS.has(key)) && (options.position === void 0 || options.position === binding.position)) return binding;
|
|
4517
4835
|
if (shouldOverride) {
|
|
4518
4836
|
const parsed = canvasTextStyleBindingSchema.safeParse({
|
|
4519
4837
|
...binding,
|
|
@@ -4527,13 +4845,16 @@ const canvasTextBindingWithFormatting = (binding, styles, shouldOverride = false
|
|
|
4527
4845
|
}
|
|
4528
4846
|
return Object.keys(styles).some((key) => STYLE_CSS.has(key)) ? null : binding;
|
|
4529
4847
|
};
|
|
4530
|
-
const
|
|
4848
|
+
const textRunFormattingOf = (command) => ({
|
|
4531
4849
|
...command.paragraphSpacing !== void 0 && { paragraphSpacing: command.paragraphSpacing },
|
|
4532
4850
|
...command.paragraphIndent !== void 0 && { paragraphIndent: command.paragraphIndent },
|
|
4533
4851
|
...command.listSpacing !== void 0 && { listSpacing: command.listSpacing },
|
|
4534
4852
|
...command.hangingPunctuation !== void 0 && { hangingPunctuation: command.hangingPunctuation },
|
|
4535
4853
|
...command.verticalTrim !== void 0 && { verticalTrim: command.verticalTrim },
|
|
4536
|
-
...command.wrapStyle !== void 0 && { wrapStyle: command.wrapStyle }
|
|
4854
|
+
...command.wrapStyle !== void 0 && { wrapStyle: command.wrapStyle },
|
|
4855
|
+
...command.stroke !== void 0 && { stroke: command.stroke },
|
|
4856
|
+
...command.decorationBlendMode !== void 0 && { decorationBlendMode: command.decorationBlendMode },
|
|
4857
|
+
...command.backgroundBlendMode !== void 0 && { backgroundBlendMode: command.backgroundBlendMode }
|
|
4537
4858
|
});
|
|
4538
4859
|
const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
4539
4860
|
if (node.kind !== "span") return [node];
|
|
@@ -4543,7 +4864,7 @@ const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
|
4543
4864
|
children: clearedOverrides(node.children, command)
|
|
4544
4865
|
};
|
|
4545
4866
|
if (command.type === "format") {
|
|
4546
|
-
const metadataKeys = Object.keys(
|
|
4867
|
+
const metadataKeys = Object.keys(textRunFormattingOf(command));
|
|
4547
4868
|
for (const key of metadataKeys) Reflect.deleteProperty(next, key);
|
|
4548
4869
|
const binding = canvasTextBindingWithFormatting(next.textStyle ?? null, command.styles, command.shouldOverrideTextStyle, {
|
|
4549
4870
|
paragraphSpacing: command.paragraphSpacing,
|
|
@@ -4572,8 +4893,8 @@ const clearedOverrides = (nodes, command) => nodes.flatMap((node) => {
|
|
|
4572
4893
|
].includes(key));
|
|
4573
4894
|
return Object.keys(next.styles).length === 0 && metadata.length === 0 ? next.children : [next];
|
|
4574
4895
|
});
|
|
4575
|
-
/**
|
|
4576
|
-
const
|
|
4896
|
+
/** Leading and decoration must share the glyph's font; outer spans add a second line-box strut. */
|
|
4897
|
+
const metricRuns = (nodes, styles) => nodes.map((node) => {
|
|
4577
4898
|
if (node.kind !== "span") return {
|
|
4578
4899
|
kind: "span",
|
|
4579
4900
|
styles,
|
|
@@ -4581,7 +4902,7 @@ const decoratedRuns = (nodes, styles) => nodes.map((node) => {
|
|
|
4581
4902
|
};
|
|
4582
4903
|
return node.children.some((child) => child.kind === "span") ? {
|
|
4583
4904
|
...node,
|
|
4584
|
-
children:
|
|
4905
|
+
children: metricRuns(node.children, styles)
|
|
4585
4906
|
} : {
|
|
4586
4907
|
...node,
|
|
4587
4908
|
styles: {
|
|
@@ -4590,7 +4911,19 @@ const decoratedRuns = (nodes, styles) => nodes.map((node) => {
|
|
|
4590
4911
|
}
|
|
4591
4912
|
};
|
|
4592
4913
|
});
|
|
4914
|
+
const linkedRuns = (nodes, command) => {
|
|
4915
|
+
const existing = canvasRichTextLinkOf(nodes);
|
|
4916
|
+
if (command.href !== null && command.href === existing) return nodes;
|
|
4917
|
+
const children = clearedOverrides(nodes, command);
|
|
4918
|
+
return command.href === null ? children : [{
|
|
4919
|
+
kind: "span",
|
|
4920
|
+
styles: existing === null ? LINK_STYLES : {},
|
|
4921
|
+
href: command.href,
|
|
4922
|
+
children
|
|
4923
|
+
}];
|
|
4924
|
+
};
|
|
4593
4925
|
const formattedRuns = (nodes, command) => {
|
|
4926
|
+
if (command.type === "link") return linkedRuns(nodes, command);
|
|
4594
4927
|
const children = clearedOverrides(nodes, command);
|
|
4595
4928
|
if (command.type === "text-style") return command.binding === null ? children : [{
|
|
4596
4929
|
kind: "span",
|
|
@@ -4599,12 +4932,12 @@ const formattedRuns = (nodes, command) => {
|
|
|
4599
4932
|
children
|
|
4600
4933
|
}];
|
|
4601
4934
|
if (command.type === "format") {
|
|
4602
|
-
const formatted = command.styles["textDecorationLine"] === void 0 ? [{
|
|
4935
|
+
const formatted = command.styles["textDecorationLine"] === void 0 && command.styles["lineHeight"] === void 0 ? [{
|
|
4603
4936
|
kind: "span",
|
|
4604
4937
|
styles: command.styles,
|
|
4605
4938
|
children
|
|
4606
|
-
}] :
|
|
4607
|
-
const metadata =
|
|
4939
|
+
}] : metricRuns(children, command.styles);
|
|
4940
|
+
const metadata = textRunFormattingOf(command);
|
|
4608
4941
|
return Object.keys(metadata).length === 0 ? formatted : [{
|
|
4609
4942
|
kind: "span",
|
|
4610
4943
|
styles: {},
|
|
@@ -4612,15 +4945,6 @@ const formattedRuns = (nodes, command) => {
|
|
|
4612
4945
|
children: formatted
|
|
4613
4946
|
}];
|
|
4614
4947
|
}
|
|
4615
|
-
if (command.type === "link") {
|
|
4616
|
-
if (command.href === null) return children;
|
|
4617
|
-
return [{
|
|
4618
|
-
kind: "span",
|
|
4619
|
-
styles: LINK_STYLES,
|
|
4620
|
-
href: command.href,
|
|
4621
|
-
children
|
|
4622
|
-
}];
|
|
4623
|
-
}
|
|
4624
4948
|
if (command.fills === null) return children;
|
|
4625
4949
|
return [{
|
|
4626
4950
|
kind: "span",
|
|
@@ -4643,6 +4967,15 @@ const isValidTextRange = (text, range) => {
|
|
|
4643
4967
|
const boundaries = boundariesOf(text);
|
|
4644
4968
|
return range.start <= range.end && boundaries.has(range.start) && boundaries.has(range.end);
|
|
4645
4969
|
};
|
|
4970
|
+
const isValidTextCharacterRange = (text, range) => {
|
|
4971
|
+
const boundaries = /* @__PURE__ */ new Set([0]);
|
|
4972
|
+
let offset = 0;
|
|
4973
|
+
for (const character of text) {
|
|
4974
|
+
offset += character.length;
|
|
4975
|
+
boundaries.add(offset);
|
|
4976
|
+
}
|
|
4977
|
+
return range.start <= range.end && boundaries.has(range.start) && boundaries.has(range.end);
|
|
4978
|
+
};
|
|
4646
4979
|
const lengthOf = (node) => node.kind === "text" ? node.text.length : node.kind === "break" ? 1 : canvasRichTextValueOf(node.children).length;
|
|
4647
4980
|
const sliceRuns = (nodes, start, end) => {
|
|
4648
4981
|
let position = 0;
|
|
@@ -4663,7 +4996,7 @@ const sliceRuns = (nodes, start, end) => {
|
|
|
4663
4996
|
}] : [node];
|
|
4664
4997
|
});
|
|
4665
4998
|
};
|
|
4666
|
-
const metadataOf = (node) => JSON.stringify(Object.fromEntries(Object.entries(node).filter(([key]) => !["children", "text"].includes(key))));
|
|
4999
|
+
const metadataOf = (node) => JSON.stringify(Object.fromEntries(Object.entries(node).filter(([key]) => !["children", "text"].includes(key))), (_key, value) => typeof value === "object" && value !== null && !Array.isArray(value) ? Object.fromEntries(Object.entries(value).toSorted(([a], [b]) => a.localeCompare(b, "en"))) : value);
|
|
4667
5000
|
const isParagraphEnd = (node) => node.kind === "span" && node.paragraph !== void 0 && canvasRichTextValueOf(node.children).endsWith("\n");
|
|
4668
5001
|
const joinRuns = (nodes) => {
|
|
4669
5002
|
const joined = [];
|
|
@@ -4815,18 +5148,25 @@ const paragraphProps = (node, range, command) => {
|
|
|
4815
5148
|
return props;
|
|
4816
5149
|
};
|
|
4817
5150
|
const replacementRuns = (runs, range, command) => {
|
|
5151
|
+
if (command.richText !== void 0) {
|
|
5152
|
+
const rich = canvasRichTextOf({ props: {
|
|
5153
|
+
text: command.text,
|
|
5154
|
+
richText: command.richText
|
|
5155
|
+
} });
|
|
5156
|
+
if (rich.length > 0) return rich;
|
|
5157
|
+
}
|
|
4818
5158
|
const shouldKeepEmpty = range.start === 0 && range.end === canvasRichTextValueOf(runs).length;
|
|
4819
5159
|
let next = insertedRuns(runs, range.start, command.text, shouldKeepEmpty);
|
|
4820
5160
|
if (command.text === "") return next;
|
|
4821
|
-
|
|
5161
|
+
const link = canvasRichTextLinkOf(sliceRuns(runs, range.start, range.start + 1));
|
|
5162
|
+
if (link !== null && range.start === range.end && canvasRichTextLinkOf(sliceRuns(runs, range.start - 1, range.start)) !== link) next = formattedRuns(next, {
|
|
5163
|
+
type: "link",
|
|
5164
|
+
href: null
|
|
5165
|
+
});
|
|
5166
|
+
if (Object.keys(command.styles ?? {}).length > 0 || Object.keys(textRunFormattingOf(command)).length > 0) next = formattedRuns(next, {
|
|
4822
5167
|
type: "format",
|
|
4823
5168
|
styles: command.styles ?? {},
|
|
4824
|
-
|
|
4825
|
-
paragraphIndent: command.paragraphIndent,
|
|
4826
|
-
listSpacing: command.listSpacing,
|
|
4827
|
-
hangingPunctuation: command.hangingPunctuation,
|
|
4828
|
-
verticalTrim: command.verticalTrim,
|
|
4829
|
-
wrapStyle: command.wrapStyle
|
|
5169
|
+
...textRunFormattingOf(command)
|
|
4830
5170
|
});
|
|
4831
5171
|
if (command.fills !== void 0) next = formattedRuns(next, {
|
|
4832
5172
|
type: "paint",
|
|
@@ -4841,7 +5181,7 @@ const replacementRuns = (runs, range, command) => {
|
|
|
4841
5181
|
/** Commands write the existing text/run pair atomically and retain unrelated source metadata. */
|
|
4842
5182
|
const canvasTextPropsWithCommand = (node, range, command) => {
|
|
4843
5183
|
const text = textOf(node) ?? "";
|
|
4844
|
-
if (!isValidTextRange(text, range)) return node.props ?? {};
|
|
5184
|
+
if (!(command.type === "paint" ? isValidTextCharacterRange(text, range) : isValidTextRange(text, range))) return node.props ?? {};
|
|
4845
5185
|
if (command.type === "paragraph" || command.type === "list-indent") return paragraphProps(node, range, command);
|
|
4846
5186
|
if (command.type !== "replace" && range.start === range.end && (text !== "" || command.type !== "text-style" && command.type !== "format")) return node.props ?? {};
|
|
4847
5187
|
if (command.type === "link" && command.href !== null && !isCanvasRichTextHref(command.href)) return node.props ?? {};
|
|
@@ -4861,7 +5201,7 @@ const canvasTextPropsWithCommand = (node, range, command) => {
|
|
|
4861
5201
|
};
|
|
4862
5202
|
Reflect.deleteProperty(props, "links");
|
|
4863
5203
|
Reflect.deleteProperty(props, "richText");
|
|
4864
|
-
if (command.type !== "replace" || command.
|
|
5204
|
+
if (command.type !== "replace" || command.richText !== void 0 || command.fills !== void 0 || command.stroke !== void 0 || command.textStyle !== void 0 || Object.keys(textRunFormattingOf(command)).length > 0 || Object.keys(command.styles ?? {}).length > 0 || canvasRichTextOf(node).length > 0 || text === "" && Array.isArray(node.props?.["richText"]) && node.props["richText"].length === 0 || textLinksOf(node).length > 0) props["richText"] = next;
|
|
4865
5205
|
return props;
|
|
4866
5206
|
};
|
|
4867
5207
|
/** A browser input is one replacement, expanded to whole graphemes before touching runs. */
|
|
@@ -4885,6 +5225,7 @@ const orderedJsonValue = (_key, value) => typeof value === "object" && value !==
|
|
|
4885
5225
|
const isSame = (left, right) => left === right || JSON.stringify(left, orderedJsonValue) === JSON.stringify(right, orderedJsonValue);
|
|
4886
5226
|
const canvasTextAttributePatch = (before, after) => Object.fromEntries([.../* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)])].flatMap((key) => isSame(before[key], after[key]) ? [] : [[key, after[key] ?? null]]));
|
|
4887
5227
|
const chunkText = (node) => node.kind === "text" ? node.text : node.soft === true ? "\u2028" : "\n";
|
|
5228
|
+
const hasMultilineParagraph = (node, ancestors) => node.kind === "text" && /\n[\s\S]/u.test(node.text) && ancestors.some((ancestor) => ancestor["paragraph"] !== void 0);
|
|
4888
5229
|
const collectChunks = (nodes) => {
|
|
4889
5230
|
const chunks = [];
|
|
4890
5231
|
let endAttributes = {};
|
|
@@ -4924,10 +5265,12 @@ const collectChunks = (nodes) => {
|
|
|
4924
5265
|
...inherited,
|
|
4925
5266
|
[TEXT_STRUCTURE]: [...ancestors, metadata]
|
|
4926
5267
|
};
|
|
5268
|
+
const shouldPreserveParagraph = hasMultilineParagraph(node, ancestors);
|
|
4927
5269
|
const text = chunkText(node);
|
|
4928
5270
|
if (text !== "") chunks.push({
|
|
4929
5271
|
text,
|
|
4930
|
-
attributes
|
|
5272
|
+
attributes,
|
|
5273
|
+
...shouldPreserveParagraph && { shouldPreserveParagraph }
|
|
4931
5274
|
});
|
|
4932
5275
|
endAttributes = attributes;
|
|
4933
5276
|
}
|
|
@@ -4943,12 +5286,13 @@ const canvasTextContentOf = (node) => {
|
|
|
4943
5286
|
const paragraph = canvasTextParagraphFormattingAt(runs, (textOf(node) ?? "").length);
|
|
4944
5287
|
return {
|
|
4945
5288
|
chunks: result.chunks.flatMap((chunk, index, all) => {
|
|
5289
|
+
if (chunk.shouldPreserveParagraph === true) return [chunk];
|
|
4946
5290
|
const prior = all[index - 1];
|
|
4947
|
-
if (prior !== void 0 && isSame(prior.attributes, chunk.attributes)) return [];
|
|
5291
|
+
if (prior !== void 0 && prior.shouldPreserveParagraph === chunk.shouldPreserveParagraph && isSame(prior.attributes, chunk.attributes)) return [];
|
|
4948
5292
|
let text = chunk.text;
|
|
4949
5293
|
for (let next = index + 1; next < all.length; next += 1) {
|
|
4950
5294
|
const following = all[next];
|
|
4951
|
-
if (following === void 0 || !isSame(chunk.attributes, following.attributes)) break;
|
|
5295
|
+
if (following === void 0 || following.shouldPreserveParagraph !== chunk.shouldPreserveParagraph || !isSame(chunk.attributes, following.attributes)) break;
|
|
4952
5296
|
text += following.text;
|
|
4953
5297
|
}
|
|
4954
5298
|
return [{
|
|
@@ -4980,7 +5324,7 @@ const sliceCanvasTextChunks = (chunks, start, end) => {
|
|
|
4980
5324
|
|
|
4981
5325
|
//#endregion
|
|
4982
5326
|
//#region ../../packages/contract/src/canvas/canvas-text-change.lib.ts
|
|
4983
|
-
const appendCanvasTextStep = (input, step) => {
|
|
5327
|
+
const appendCanvasTextStep = (input, step, shouldShareParagraph = false) => {
|
|
4984
5328
|
if ((step.kind === "insert" ? step.text.length : step.count) === 0) return;
|
|
4985
5329
|
const steps = input;
|
|
4986
5330
|
const previous = steps.at(-1);
|
|
@@ -4991,14 +5335,14 @@ const appendCanvasTextStep = (input, step) => {
|
|
|
4991
5335
|
};
|
|
4992
5336
|
return;
|
|
4993
5337
|
}
|
|
4994
|
-
if (previous?.kind === "retain" && step.kind === "retain" && JSON.stringify(previous.attributes ?? {}) === JSON.stringify(step.attributes ?? {})) {
|
|
5338
|
+
if (previous?.kind === "retain" && step.kind === "retain" && (shouldShareParagraph || step.shouldPreserveParagraph !== true) && previous.shouldPreserveParagraph === step.shouldPreserveParagraph && JSON.stringify(previous.attributes ?? {}) === JSON.stringify(step.attributes ?? {})) {
|
|
4995
5339
|
steps[steps.length - 1] = {
|
|
4996
5340
|
...step,
|
|
4997
5341
|
count: previous.count + step.count
|
|
4998
5342
|
};
|
|
4999
5343
|
return;
|
|
5000
5344
|
}
|
|
5001
|
-
if (previous?.kind === "insert" && step.kind === "insert" && JSON.stringify(previous.attributes ?? {}) === JSON.stringify(step.attributes ?? {})) {
|
|
5345
|
+
if (previous?.kind === "insert" && step.kind === "insert" && (shouldShareParagraph || step.shouldPreserveParagraph !== true) && previous.shouldPreserveParagraph === step.shouldPreserveParagraph && JSON.stringify(previous.attributes ?? {}) === JSON.stringify(step.attributes ?? {})) {
|
|
5002
5346
|
steps[steps.length - 1] = {
|
|
5003
5347
|
...step,
|
|
5004
5348
|
text: previous.text + step.text
|
|
@@ -5016,10 +5360,12 @@ const retainFormatting = (steps, before, after) => {
|
|
|
5016
5360
|
const following = sliceCanvasTextChunks(after, offset, offset + chunk.text.length);
|
|
5017
5361
|
for (const next of following) {
|
|
5018
5362
|
const attributes = canvasTextAttributePatch(chunk.attributes, next.attributes);
|
|
5363
|
+
const shouldPreserveParagraph = next.shouldPreserveParagraph === true;
|
|
5019
5364
|
appendCanvasTextStep(steps, {
|
|
5020
5365
|
kind: "retain",
|
|
5021
5366
|
count: next.text.length,
|
|
5022
|
-
...Object.keys(attributes).length > 0 && { attributes }
|
|
5367
|
+
...Object.keys(attributes).length > 0 && { attributes },
|
|
5368
|
+
...(chunk.shouldPreserveParagraph === true !== shouldPreserveParagraph || shouldPreserveParagraph && Object.hasOwn(attributes, "$structure")) && { shouldPreserveParagraph }
|
|
5023
5369
|
});
|
|
5024
5370
|
}
|
|
5025
5371
|
offset += chunk.text.length;
|
|
@@ -5134,6 +5480,7 @@ const canvasVersionEntrySchema = z.object({
|
|
|
5134
5480
|
actor: canvasVersionActorSchema,
|
|
5135
5481
|
sourceVersionEntryId: z.uuid().nullable(),
|
|
5136
5482
|
expiresAt: z.iso.datetime().nullable(),
|
|
5483
|
+
checkpointAt: z.iso.datetime(),
|
|
5137
5484
|
createdAt: z.iso.datetime(),
|
|
5138
5485
|
updatedAt: z.iso.datetime(),
|
|
5139
5486
|
screenCount: z.number().int().min(0)
|
|
@@ -5355,7 +5702,7 @@ const acceptInviteInputSchema = z.object({ token: inviteTokenSchema });
|
|
|
5355
5702
|
const previewInviteInputSchema = z.object({ token: inviteTokenSchema });
|
|
5356
5703
|
const acceptInviteOutputSchema = z.object({
|
|
5357
5704
|
canvasId: z.uuid(),
|
|
5358
|
-
accessLevel:
|
|
5705
|
+
accessLevel: accessLevelSchema
|
|
5359
5706
|
});
|
|
5360
5707
|
|
|
5361
5708
|
//#endregion
|
|
@@ -5404,7 +5751,7 @@ const setReviewStateInputSchema = z.object({
|
|
|
5404
5751
|
])
|
|
5405
5752
|
});
|
|
5406
5753
|
/**
|
|
5407
|
-
* @justified
|
|
5754
|
+
* @justified warning
|
|
5408
5755
|
* `null` means nothing was recorded, which is the honest answer for a link visitor: review
|
|
5409
5756
|
* state lives on a membership row and they have none. Echoing the requested state back would
|
|
5410
5757
|
* read as stored and disagree with the next read.
|
|
@@ -5433,6 +5780,30 @@ const captureBlobSchema = z.strictObject({
|
|
|
5433
5780
|
bytes: z.number().int().positive(),
|
|
5434
5781
|
mediaType: z.string().min(1).max(CAPTURE_METADATA_LENGTH)
|
|
5435
5782
|
});
|
|
5783
|
+
const captureDestinationSchema = z.strictObject({ organisationId: z.uuid().optional() });
|
|
5784
|
+
const captureContextSchema = z.strictObject({
|
|
5785
|
+
key: z.string().min(1),
|
|
5786
|
+
label: z.string().min(1),
|
|
5787
|
+
url: z.url().optional(),
|
|
5788
|
+
sequence: z.number().int().nonnegative(),
|
|
5789
|
+
attempt: z.number().int().nonnegative().default(0)
|
|
5790
|
+
});
|
|
5791
|
+
const captureBaselineSelectionSchema = z.union([z.strictObject({ runId: z.uuid() }), z.strictObject({
|
|
5792
|
+
reference: z.string().min(1),
|
|
5793
|
+
revision: z.string().min(1).optional()
|
|
5794
|
+
})]);
|
|
5795
|
+
const captureReviewMetadataSchema = z.strictObject({
|
|
5796
|
+
destination: captureDestinationSchema,
|
|
5797
|
+
context: captureContextSchema.optional(),
|
|
5798
|
+
revision: z.string().min(1).optional(),
|
|
5799
|
+
baselineRunId: z.uuid().nullable(),
|
|
5800
|
+
compareTo: captureBaselineSelectionSchema.optional()
|
|
5801
|
+
});
|
|
5802
|
+
const captureVerdictSchema = z.enum([
|
|
5803
|
+
"awaiting-review",
|
|
5804
|
+
"approved",
|
|
5805
|
+
"changes-requested"
|
|
5806
|
+
]);
|
|
5436
5807
|
const captureArtifactSchema = z.strictObject({
|
|
5437
5808
|
format: z.literal("enhance-capture"),
|
|
5438
5809
|
version: z.literal(1),
|
|
@@ -5440,6 +5811,7 @@ const captureArtifactSchema = z.strictObject({
|
|
|
5440
5811
|
label: key,
|
|
5441
5812
|
journeyLabel: key,
|
|
5442
5813
|
order: z.number().int().nonnegative(),
|
|
5814
|
+
page: z.string().min(1).optional(),
|
|
5443
5815
|
viewport: z.strictObject({
|
|
5444
5816
|
width: dimension,
|
|
5445
5817
|
height: dimension,
|
|
@@ -5512,7 +5884,8 @@ const captureRunDescriptorSchema = z.strictObject({
|
|
|
5512
5884
|
generation: z.number().int().nonnegative(),
|
|
5513
5885
|
participants: z.array(key).min(1),
|
|
5514
5886
|
expiresAt: z.iso.datetime(),
|
|
5515
|
-
formatVersion: z.literal(1)
|
|
5887
|
+
formatVersion: z.literal(1),
|
|
5888
|
+
review: captureReviewMetadataSchema.optional()
|
|
5516
5889
|
});
|
|
5517
5890
|
const captureAttemptSchema = z.strictObject({
|
|
5518
5891
|
participant: key,
|
|
@@ -5560,11 +5933,25 @@ const captureReceiptSchema = z.strictObject({
|
|
|
5560
5933
|
}))
|
|
5561
5934
|
});
|
|
5562
5935
|
const beginCaptureRunInputSchema = z.strictObject({
|
|
5563
|
-
canvasId: z.uuid(),
|
|
5936
|
+
canvasId: z.uuid().optional(),
|
|
5937
|
+
destination: captureDestinationSchema.optional(),
|
|
5938
|
+
title: z.string().trim().min(1).optional(),
|
|
5939
|
+
context: captureContextSchema.optional(),
|
|
5940
|
+
revision: z.string().min(1).optional(),
|
|
5941
|
+
compareTo: captureBaselineSelectionSchema.optional(),
|
|
5564
5942
|
source: key.default("default"),
|
|
5565
5943
|
runKey: key,
|
|
5566
5944
|
participants: z.array(key).min(1).default(["local"]),
|
|
5567
5945
|
formatVersion: z.literal(1).default(1)
|
|
5946
|
+
}).superRefine((input, ctx) => {
|
|
5947
|
+
if (input.canvasId === void 0 === (input.destination === void 0)) ctx.addIssue({
|
|
5948
|
+
code: "custom",
|
|
5949
|
+
message: "Choose either a canvas or a destination for this run."
|
|
5950
|
+
});
|
|
5951
|
+
if (input.canvasId !== void 0 && (input.context !== void 0 || input.compareTo !== void 0)) ctx.addIssue({
|
|
5952
|
+
code: "custom",
|
|
5953
|
+
message: "Run review requires a destination."
|
|
5954
|
+
});
|
|
5568
5955
|
});
|
|
5569
5956
|
const beginCaptureRunOutputSchema = z.strictObject({ run: captureRunDescriptorSchema });
|
|
5570
5957
|
const getCaptureRunInputSchema = z.strictObject({ runId: z.uuid() });
|
|
@@ -5580,6 +5967,7 @@ const getCaptureRunOutputSchema = z.strictObject({
|
|
|
5580
5967
|
run: captureRunDescriptorSchema,
|
|
5581
5968
|
state: captureRunStateSchema,
|
|
5582
5969
|
receipt: captureReceiptSchema.nullable(),
|
|
5970
|
+
verdict: captureVerdictSchema.optional(),
|
|
5583
5971
|
failure: z.strictObject({
|
|
5584
5972
|
code: key,
|
|
5585
5973
|
message: z.string().max(CAPTURE_FAILURE_LENGTH)
|
|
@@ -6483,7 +6871,7 @@ const ROOT_FIXTURE_NODE_ID = "root";
|
|
|
6483
6871
|
const SORT_KEY_DIGITS = 4;
|
|
6484
6872
|
const sortKeyAt = (seat) => `a${String(seat).padStart(SORT_KEY_DIGITS, "0")}`;
|
|
6485
6873
|
const emptyFixtureDocument = () => ({
|
|
6486
|
-
version:
|
|
6874
|
+
version: 11,
|
|
6487
6875
|
nodes: { [ROOT_FIXTURE_NODE_ID]: {
|
|
6488
6876
|
id: ROOT_FIXTURE_NODE_ID,
|
|
6489
6877
|
label: "Canvas",
|
|
@@ -6529,6 +6917,11 @@ const organisationRoleSchema = z.enum([
|
|
|
6529
6917
|
"admin",
|
|
6530
6918
|
"member"
|
|
6531
6919
|
]);
|
|
6920
|
+
const organisationContentAccessSchema = z.enum([
|
|
6921
|
+
"can-view",
|
|
6922
|
+
"can-comment",
|
|
6923
|
+
"can-edit"
|
|
6924
|
+
]);
|
|
6532
6925
|
/** One team a person is in, as the switcher lists it. */
|
|
6533
6926
|
const organisationSchema = z.object({
|
|
6534
6927
|
id: z.uuid(),
|
|
@@ -6561,6 +6954,7 @@ const memberSchema = z.object({
|
|
|
6561
6954
|
initials: z.string().max(4),
|
|
6562
6955
|
avatarUrl: z.string().max(MAX_URL_LENGTH).nullable().optional(),
|
|
6563
6956
|
email: z.string().max(254).nullable(),
|
|
6957
|
+
contentAccess: organisationContentAccessSchema.default("can-comment"),
|
|
6564
6958
|
role: organisationRoleSchema
|
|
6565
6959
|
});
|
|
6566
6960
|
const listMembersInputSchema = z.object({ organisationId: z.uuid() });
|
|
@@ -6568,7 +6962,8 @@ const listMembersOutputSchema = cappedSchema(memberSchema);
|
|
|
6568
6962
|
const addMemberInputSchema = z.object({
|
|
6569
6963
|
organisationId: z.uuid(),
|
|
6570
6964
|
email: z.email().trim().toLowerCase().max(254),
|
|
6571
|
-
role: z.enum(["admin", "member"]).default("member")
|
|
6965
|
+
role: z.enum(["admin", "member"]).default("member"),
|
|
6966
|
+
contentAccess: organisationContentAccessSchema.default("can-comment")
|
|
6572
6967
|
});
|
|
6573
6968
|
const addMemberOutputSchema = z.object({ personId: z.uuid() });
|
|
6574
6969
|
const setMemberRoleInputSchema = z.object({
|
|
@@ -6580,6 +6975,15 @@ const setMemberRoleOutputSchema = setMemberRoleInputSchema.pick({
|
|
|
6580
6975
|
personId: true,
|
|
6581
6976
|
role: true
|
|
6582
6977
|
});
|
|
6978
|
+
const setMemberContentAccessInputSchema = z.object({
|
|
6979
|
+
organisationId: z.uuid(),
|
|
6980
|
+
personId: z.uuid(),
|
|
6981
|
+
contentAccess: organisationContentAccessSchema
|
|
6982
|
+
});
|
|
6983
|
+
const setMemberContentAccessOutputSchema = setMemberContentAccessInputSchema.pick({
|
|
6984
|
+
personId: true,
|
|
6985
|
+
contentAccess: true
|
|
6986
|
+
});
|
|
6583
6987
|
const removeMemberInputSchema = z.object({
|
|
6584
6988
|
organisationId: z.uuid(),
|
|
6585
6989
|
personId: z.uuid()
|
|
@@ -6596,6 +7000,7 @@ const transferOrganisationOwnershipOutputSchema = z.object({ ownerPersonId: z.uu
|
|
|
6596
7000
|
const teamInviteSchema = z.object({
|
|
6597
7001
|
inviteId: z.uuid(),
|
|
6598
7002
|
email: z.string().max(254).pipe(z.email()),
|
|
7003
|
+
contentAccess: organisationContentAccessSchema.default("can-comment"),
|
|
6599
7004
|
role: z.enum(["admin", "member"]),
|
|
6600
7005
|
sendCount: z.number().int().min(1),
|
|
6601
7006
|
lastSentAt: z.iso.datetime(),
|
|
@@ -6611,7 +7016,8 @@ const teamInviteSchema = z.object({
|
|
|
6611
7016
|
const createTeamInviteInputSchema = z.object({
|
|
6612
7017
|
organisationId: z.uuid(),
|
|
6613
7018
|
email: z.string().trim().toLowerCase().max(254).pipe(z.email()),
|
|
6614
|
-
role: z.enum(["admin", "member"]).default("member")
|
|
7019
|
+
role: z.enum(["admin", "member"]).default("member"),
|
|
7020
|
+
contentAccess: organisationContentAccessSchema.default("can-comment")
|
|
6615
7021
|
});
|
|
6616
7022
|
const createTeamInviteOutputSchema = z.discriminatedUnion("kind", [z.object({
|
|
6617
7023
|
kind: z.literal("member"),
|
|
@@ -6635,6 +7041,7 @@ const teamInvitePreviewSchema = z.object({
|
|
|
6635
7041
|
teamName: z.string().min(1).max(120),
|
|
6636
7042
|
invitedBy: z.string().min(1).max(120),
|
|
6637
7043
|
email: z.string().max(254).pipe(z.email()),
|
|
7044
|
+
contentAccess: organisationContentAccessSchema.default("can-comment"),
|
|
6638
7045
|
role: z.enum(["admin", "member"]),
|
|
6639
7046
|
expiresAt: z.iso.datetime(),
|
|
6640
7047
|
state: z.enum(["pending", "accepted"]),
|
|
@@ -6807,13 +7214,13 @@ const recentRecipientsOutputSchema = searchRecipientsOutputSchema.extend({});
|
|
|
6807
7214
|
//#endregion
|
|
6808
7215
|
//#region ../../packages/contract/src/person/session-handoff.lib.ts
|
|
6809
7216
|
/**
|
|
6810
|
-
* @justified
|
|
7217
|
+
* @justified intent
|
|
6811
7218
|
* How the web page keeps an extension's session in step, and why it is not the page bridge.
|
|
6812
7219
|
*
|
|
6813
7220
|
* The recorder's bridge is a channel any page shares with a content script, so nothing on it
|
|
6814
7221
|
* is trusted beyond its shape. This one is the opposite: it carries a credential, it is posted
|
|
6815
7222
|
* at our own origin, and the only listener is a content script this extension put on our own
|
|
6816
|
-
* app. A different trust story wants a different door
|
|
7223
|
+
* app. A different trust story wants a different door.
|
|
6817
7224
|
*/
|
|
6818
7225
|
const SESSION_HANDOFF = "enhance3:session-handoff";
|
|
6819
7226
|
const sessionHandoffSchema = z.union([z.object({
|
|
@@ -6832,11 +7239,11 @@ const sessionHandoffSchema = z.union([z.object({
|
|
|
6832
7239
|
const PROTOTYPE_ARTIFACT_PROTOCOL_VERSION = 1;
|
|
6833
7240
|
const PROTOTYPE_ARTIFACT_FORMAT = "zip";
|
|
6834
7241
|
const PROTOTYPE_ARTIFACT_MANIFEST_PATH = "__enhance/manifest.json";
|
|
6835
|
-
const SHA256_HEX_LENGTH = 64;
|
|
7242
|
+
const SHA256_HEX_LENGTH$1 = 64;
|
|
6836
7243
|
const CONTENT_TYPE_LENGTH = 200;
|
|
6837
7244
|
const LAST_C0_CONTROL = 31;
|
|
6838
7245
|
const DELETE_CONTROL = 127;
|
|
6839
|
-
const sha256Schema = z.string().length(SHA256_HEX_LENGTH).refine((value) => {
|
|
7246
|
+
const sha256Schema = z.string().length(SHA256_HEX_LENGTH$1).refine((value) => {
|
|
6840
7247
|
for (const character of value) if (!/[\da-f]/u.test(character)) return false;
|
|
6841
7248
|
return true;
|
|
6842
7249
|
});
|
|
@@ -7207,6 +7614,7 @@ const prototypeBridgeNavigationRequestSchema = z$1.object({
|
|
|
7207
7614
|
const prototypeBridgeNavigationStateSchema = z$1.object({
|
|
7208
7615
|
protocol: z$1.literal(1),
|
|
7209
7616
|
type: z$1.literal("enhance.prototype.navigation"),
|
|
7617
|
+
path: z$1.optional(z$1.string()),
|
|
7210
7618
|
canGoBack: z$1.boolean(),
|
|
7211
7619
|
canGoForward: z$1.boolean(),
|
|
7212
7620
|
isNavigating: z$1._default(z$1.boolean(), false)
|
|
@@ -7243,7 +7651,6 @@ const MAX_DURATION_MS$2 = 6e4;
|
|
|
7243
7651
|
const MAX_POINTER_SLOP = 50;
|
|
7244
7652
|
const MIN_SINGLE_AXIS_RATIO = .25;
|
|
7245
7653
|
const MAX_AXIS_RATIO = 4;
|
|
7246
|
-
const MAX_RETAINED_FRAMES = 10;
|
|
7247
7654
|
const MAX_REASON_LENGTH = 120;
|
|
7248
7655
|
const MAX_MOMENTUM_TAIL_SPEED = 1e3;
|
|
7249
7656
|
const MAX_OPENING_SAMPLE_PX = 16;
|
|
@@ -7256,9 +7663,7 @@ const defaults = {
|
|
|
7256
7663
|
momentumTailSpeed: 100,
|
|
7257
7664
|
axisRatio: 1.25,
|
|
7258
7665
|
openingSamplePx: 4,
|
|
7259
|
-
openingWindowMs: 35
|
|
7260
|
-
retainedFrames: 3,
|
|
7261
|
-
retentionGraceMs: 6e4
|
|
7666
|
+
openingWindowMs: 35
|
|
7262
7667
|
};
|
|
7263
7668
|
/** The shipped input behaviour. The policies are fixed; the protocol carries them so a host and an
|
|
7264
7669
|
* app built from different releases still agree. */
|
|
@@ -7271,9 +7676,7 @@ const prototypeInputSettingsSchema = z$1.object({
|
|
|
7271
7676
|
wheelQuietMs: z$1._default(duration, defaults.wheelQuietMs),
|
|
7272
7677
|
pointerSlopPx: z$1._default(z$1.number().check(z$1.minimum(0), z$1.maximum(MAX_POINTER_SLOP)), defaults.pointerSlopPx),
|
|
7273
7678
|
singleAxisRatio: z$1._default(z$1.number().check(z$1.minimum(MIN_SINGLE_AXIS_RATIO), z$1.maximum(MAX_AXIS_RATIO)), defaults.singleAxisRatio),
|
|
7274
|
-
axisRatio: z$1._default(z$1.number().check(z$1.minimum(1), z$1.maximum(MAX_AXIS_RATIO)), defaults.axisRatio)
|
|
7275
|
-
retainedFrames: z$1._default(z$1.int().check(z$1.minimum(0), z$1.maximum(MAX_RETAINED_FRAMES)), defaults.retainedFrames),
|
|
7276
|
-
retentionGraceMs: z$1._default(duration, defaults.retentionGraceMs)
|
|
7679
|
+
axisRatio: z$1._default(z$1.number().check(z$1.minimum(1), z$1.maximum(MAX_AXIS_RATIO)), defaults.axisRatio)
|
|
7277
7680
|
});
|
|
7278
7681
|
const DEFAULT_PROTOTYPE_INPUT_SETTINGS = prototypeInputSettingsSchema.parse({});
|
|
7279
7682
|
const message = z$1.object({ inputVersion: z$1.literal(2) });
|
|
@@ -7327,6 +7730,10 @@ const prototypeInputPanSchema = z$1.extend(message, {
|
|
|
7327
7730
|
"cancel"
|
|
7328
7731
|
]),
|
|
7329
7732
|
pointerId: z$1.int().check(z$1.nonnegative()),
|
|
7733
|
+
clientPoint: z$1.optional(z$1.object({
|
|
7734
|
+
x: z$1.number(),
|
|
7735
|
+
y: z$1.number()
|
|
7736
|
+
})),
|
|
7330
7737
|
screenX: z$1.number(),
|
|
7331
7738
|
screenY: z$1.number(),
|
|
7332
7739
|
anchorX: z$1.number().check(z$1.minimum(0), z$1.maximum(1)),
|
|
@@ -7367,12 +7774,21 @@ const prototypeInputReadySchema = z$1.extend(message, {
|
|
|
7367
7774
|
type: z$1.literal("enhance.prototype.input-ready"),
|
|
7368
7775
|
build: z$1.string().check(z$1.maxLength(MAX_REASON_LENGTH))
|
|
7369
7776
|
});
|
|
7777
|
+
const prototypeInputContextMenuSchema = z$1.extend(message, {
|
|
7778
|
+
type: z$1.literal("enhance.prototype.context-menu"),
|
|
7779
|
+
anchorX: z$1.number().check(z$1.minimum(0), z$1.maximum(1)),
|
|
7780
|
+
anchorY: z$1.number().check(z$1.minimum(0), z$1.maximum(1)),
|
|
7781
|
+
keyboard: z$1.boolean(),
|
|
7782
|
+
ctrlKey: z$1.boolean(),
|
|
7783
|
+
metaKey: z$1.boolean()
|
|
7784
|
+
});
|
|
7370
7785
|
/** Everything an app posts to its host, parsed once by message type. */
|
|
7371
7786
|
const prototypeInputMessageSchema = z$1.discriminatedUnion("type", [
|
|
7372
7787
|
prototypeInputWheelSchema,
|
|
7373
7788
|
prototypeInputActivitySchema,
|
|
7374
7789
|
prototypeInputReadySchema,
|
|
7375
|
-
prototypeInputPanSchema
|
|
7790
|
+
prototypeInputPanSchema,
|
|
7791
|
+
prototypeInputContextMenuSchema
|
|
7376
7792
|
]);
|
|
7377
7793
|
|
|
7378
7794
|
//#endregion
|
|
@@ -7398,12 +7814,12 @@ const recordingAssetPath = (assetBundleId, urlHash) => `${RECORDING_ASSET_PATH_P
|
|
|
7398
7814
|
//#endregion
|
|
7399
7815
|
//#region ../../packages/contract/src/recording/popover-state.lib.ts
|
|
7400
7816
|
/**
|
|
7401
|
-
* @justified
|
|
7817
|
+
* @justified clarification
|
|
7402
7818
|
* Added to the serialised copy: native popover state has no corresponding HTML attribute.
|
|
7403
7819
|
*/
|
|
7404
7820
|
const OPEN_POPOVER_ATTRIBUTE = "data-enhance-popover-open";
|
|
7405
7821
|
/**
|
|
7406
|
-
* @justified
|
|
7822
|
+
* @justified intent
|
|
7407
7823
|
* A scriptless captured screen still draws the popover even though it cannot call showPopover.
|
|
7408
7824
|
*/
|
|
7409
7825
|
const OPEN_POPOVER_RULE = `[${OPEN_POPOVER_ATTRIBUTE}] { display: block !important; }`;
|
|
@@ -7424,7 +7840,7 @@ const MAX_SAMPLE_RATE_HZ = 192e3;
|
|
|
7424
7840
|
/** How many gaps are worth naming individually before the count is the whole answer. */
|
|
7425
7841
|
const MAX_REPORTED_MISSING = 64;
|
|
7426
7842
|
/**
|
|
7427
|
-
* @justified
|
|
7843
|
+
* @justified warning
|
|
7428
7844
|
* Null is a real outcome here, not a failure.
|
|
7429
7845
|
*
|
|
7430
7846
|
* A walkthrough recorded without a microphone — refused, none plugged in, or held by something
|
|
@@ -7457,7 +7873,7 @@ const startRecordingOutputSchema = z.object({
|
|
|
7457
7873
|
audioUpload: signedUploadSchema.nullable()
|
|
7458
7874
|
});
|
|
7459
7875
|
/**
|
|
7460
|
-
* @justified
|
|
7876
|
+
* @justified warning
|
|
7461
7877
|
* A chunk is a byte range of one stream, not a list of events.
|
|
7462
7878
|
*
|
|
7463
7879
|
* The stream is newline-delimited JSON: one event per line. `JSON.stringify` escapes a newline
|
|
@@ -7569,7 +7985,7 @@ const recordingSummarySchema = z.object({
|
|
|
7569
7985
|
startedAt: z.iso.datetime()
|
|
7570
7986
|
});
|
|
7571
7987
|
/**
|
|
7572
|
-
* @justified
|
|
7988
|
+
* @justified intent
|
|
7573
7989
|
* The files the recorded page loaded, reserved in one call and confirmed in one more.
|
|
7574
7990
|
*
|
|
7575
7991
|
* rrweb inlines a page's CSS and leaves fonts and images pointing at the live web, so a replay
|
|
@@ -7710,6 +8126,7 @@ const createScreenInputSchema = z.object({
|
|
|
7710
8126
|
* same `atMs` after a re-record is a different screen and gets a new token.
|
|
7711
8127
|
*/
|
|
7712
8128
|
clientToken: z.uuid(),
|
|
8129
|
+
isRecordingMark: z.boolean().default(true),
|
|
7713
8130
|
provenance: z.object({
|
|
7714
8131
|
sourceRecordingId: z.uuid(),
|
|
7715
8132
|
atMs: z.number().int().min(0)
|
|
@@ -7980,9 +8397,19 @@ const clientRenderFailureDetailsSchema = z.strictObject({
|
|
|
7980
8397
|
"resize-observer-loop",
|
|
7981
8398
|
"unexpected-error",
|
|
7982
8399
|
"application-empty",
|
|
7983
|
-
"startup-stalled"
|
|
8400
|
+
"startup-stalled",
|
|
8401
|
+
"export-incomplete",
|
|
8402
|
+
"clipboard-unavailable",
|
|
8403
|
+
"clipboard-image-pending",
|
|
8404
|
+
"clipboard-image-unavailable"
|
|
8405
|
+
]),
|
|
8406
|
+
controlId: z.enum([
|
|
8407
|
+
"canvas-stacking",
|
|
8408
|
+
"canvas-export",
|
|
8409
|
+
"styles-copy",
|
|
8410
|
+
"styles-paste",
|
|
8411
|
+
"unknown"
|
|
7984
8412
|
]),
|
|
7985
|
-
controlId: z.enum(["canvas-stacking", "unknown"]),
|
|
7986
8413
|
outcome: z.enum([
|
|
7987
8414
|
"failed",
|
|
7988
8415
|
"displayed",
|
|
@@ -8013,10 +8440,6 @@ const clientRenderFailureOutputSchema = z.object({ accepted: z.literal(true) });
|
|
|
8013
8440
|
|
|
8014
8441
|
//#endregion
|
|
8015
8442
|
//#region ../../packages/contract/src/shared/client-save.schema.ts
|
|
8016
|
-
const MAX_REPORTED_CHANGES = 1e3;
|
|
8017
|
-
const MAX_REPORTED_ATTEMPTS = 1e3;
|
|
8018
|
-
/** A week. */
|
|
8019
|
-
const MAX_REPORTED_DURATION_MS = 6048e5;
|
|
8020
8443
|
/** Why the sync owner could not merge pending text the ordinary way. Never document content. */
|
|
8021
8444
|
const CLIENT_SAVE_ISSUES = [
|
|
8022
8445
|
"text-layer-missing",
|
|
@@ -8059,9 +8482,9 @@ const clientSaveIncidentInputSchema = z.strictObject({
|
|
|
8059
8482
|
detail: z.enum(CANVAS_SYNC_DETAILS).optional(),
|
|
8060
8483
|
mutationId: z.uuid().optional(),
|
|
8061
8484
|
version: z.number().int().nonnegative(),
|
|
8062
|
-
attempts: z.number().int().
|
|
8063
|
-
durationMs: z.number().int().
|
|
8064
|
-
pendingChanges: z.number().int().
|
|
8485
|
+
attempts: z.number().int().nonnegative(),
|
|
8486
|
+
durationMs: z.number().int().nonnegative(),
|
|
8487
|
+
pendingChanges: z.number().int().nonnegative()
|
|
8065
8488
|
});
|
|
8066
8489
|
const clientSaveIncidentOutputSchema = z.object({ accepted: z.literal(true) });
|
|
8067
8490
|
|
|
@@ -8922,6 +9345,7 @@ const canvasRemoveCapabilityInputSchema = canvasRemoveInputSchema.omit({ clientT
|
|
|
8922
9345
|
//#endregion
|
|
8923
9346
|
//#region src/application/canvas-render-file.schema.ts
|
|
8924
9347
|
const canvasRenderFileSchema = z.object({
|
|
9348
|
+
source: canvasRenderSourceSchema.optional(),
|
|
8925
9349
|
jobId: z.uuid(),
|
|
8926
9350
|
operation: z.object({
|
|
8927
9351
|
kind: z.literal("canvas-render"),
|
|
@@ -9652,6 +10076,7 @@ const operationStatusOutputSchema = z.union([
|
|
|
9652
10076
|
...page,
|
|
9653
10077
|
entries: z.array(renderStatusEntrySchema).max(MAX_STATUS_ENTRIES)
|
|
9654
10078
|
}),
|
|
10079
|
+
source: canvasRenderSourceSchema.optional(),
|
|
9655
10080
|
pixelsDelivered: z.boolean(),
|
|
9656
10081
|
imageContentIndex: z.number().int().nonnegative().optional(),
|
|
9657
10082
|
warnings: z.array(z.string())
|
|
@@ -10239,6 +10664,7 @@ const CANVAS_PROTOTYPE_CAPABILITY_SPECS = [{
|
|
|
10239
10664
|
//#endregion
|
|
10240
10665
|
//#region src/infrastructure/capability-example.mapper.ts
|
|
10241
10666
|
const jsonRecordSchema$2 = z.record(z.string(), z.unknown());
|
|
10667
|
+
const SHA256_HEX_LENGTH = 64;
|
|
10242
10668
|
const recordFrom$3 = (value) => {
|
|
10243
10669
|
const parsed = jsonRecordSchema$2.safeParse(value);
|
|
10244
10670
|
return parsed.success ? parsed.data : null;
|
|
@@ -10248,7 +10674,9 @@ const stringExample = (schema) => {
|
|
|
10248
10674
|
if (schema["format"] === "email") return "agent@example.test";
|
|
10249
10675
|
if (schema["format"] === "date-time") return "2026-08-10T00:00:00.000Z";
|
|
10250
10676
|
if (schema["format"] === "uri" || schema["format"] === "url") return "https://example.test/path";
|
|
10251
|
-
|
|
10677
|
+
const pattern = typeof schema["pattern"] === "string" ? schema["pattern"] : "";
|
|
10678
|
+
if (pattern === "^[a-f0-9]{64}$") return "a".repeat(SHA256_HEX_LENGTH);
|
|
10679
|
+
if (pattern.includes("development")) return "development";
|
|
10252
10680
|
const minimum = typeof schema["minLength"] === "number" ? schema["minLength"] : 1;
|
|
10253
10681
|
return "x".repeat(Math.max(1, minimum));
|
|
10254
10682
|
};
|
|
@@ -10312,6 +10740,7 @@ const CANVAS_VERSION_OPTION_DESCRIPTIONS = {
|
|
|
10312
10740
|
//#endregion
|
|
10313
10741
|
//#region src/infrastructure/procedure-descriptions.consts.ts
|
|
10314
10742
|
const PROCEDURE_DESCRIPTIONS = {
|
|
10743
|
+
"captureRun.review": "Read a captured run’s baseline, changed screens, whole-canvas verdict, and related runs.",
|
|
10315
10744
|
...CANVAS_VERSION_PROCEDURE_DESCRIPTIONS,
|
|
10316
10745
|
"canvas.createEditableFrame": "Insert one validated primitive subtree beside its source screen as an atomic canvas edit.",
|
|
10317
10746
|
"canvas.create": "Create a canvas and return the id required by canvas-scoped commands.",
|
|
@@ -10361,6 +10790,7 @@ const PROCEDURE_DESCRIPTIONS = {
|
|
|
10361
10790
|
"organisation.delete": "Delete a team and rehome every canvas to its creator’s personal shelf.",
|
|
10362
10791
|
"organisation.people.list": "List the people and roles in a team.",
|
|
10363
10792
|
"organisation.people.add": "Add an existing account by email; use organisation invites create when no account exists.",
|
|
10793
|
+
"organisation.people.setContentAccess": "Change team content access independently of the member’s administrative role.",
|
|
10364
10794
|
"organisation.people.setRole": "Change a team member between administrator and member.",
|
|
10365
10795
|
"organisation.people.remove": "Remove a person from a team without deleting their account.",
|
|
10366
10796
|
"organisation.people.transferOwnership": "Transfer team ownership to another current member.",
|
|
@@ -10434,7 +10864,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
10434
10864
|
"--collection": "Canvas shelf: `own` (default), `everything`, or a team UUID from `organisation list`.",
|
|
10435
10865
|
"--scope": "Within the shelf, return `all`, only `mine`, or only canvases `shared` with me.",
|
|
10436
10866
|
"--deleted": "Set true to search the recoverable canvas bin instead of active canvases.",
|
|
10437
|
-
"--access-state": "Filter or set link reach: invite-only, link-view, or link-
|
|
10867
|
+
"--access-state": "Filter or set link reach: invite-only, link-view, link-comment, or link-edit.",
|
|
10438
10868
|
"--has-unresolved": "Set true to return only canvases with unresolved comment threads.",
|
|
10439
10869
|
"--base-version": "Document version returned by `enhance canvas document get`.",
|
|
10440
10870
|
"--document-format-version": "Supported canvas schema version for this writer, not the saved revision in baseVersion. Update the client if its format is no longer supported.",
|
|
@@ -10445,7 +10875,8 @@ const OPTION_DESCRIPTIONS = {
|
|
|
10445
10875
|
"--bounds": "Optional world-space activity bounds as x, y, width, and height JSON.",
|
|
10446
10876
|
"--activity-id": "Active agent-work lease id returned by canvas realtime activity begin.",
|
|
10447
10877
|
"--role": "Team role to grant: admin or member.",
|
|
10448
|
-
"--access
|
|
10878
|
+
"--content-access": "Team content access to grant independently of its administrative role: can-edit, can-comment, or can-view.",
|
|
10879
|
+
"--access-level": "Participant access to grant: can-edit, can-comment, or can-view.",
|
|
10449
10880
|
"--expires-at": "ISO date-time when the token expires, or the literal null for no expiry.",
|
|
10450
10881
|
"--etag": "ETag returned by the signed upload PUT, with surrounding quotes removed.",
|
|
10451
10882
|
"--index": "Zero-based chunk index expected by the current recording upload.",
|
|
@@ -10536,6 +10967,7 @@ const OPTION_DESCRIPTIONS = {
|
|
|
10536
10967
|
"recordingAsset.reserve --assets": "One or more JSON objects shaped `{\"url\":\"https://…\",\"contentType\":\"image/png\",\"byteSize\":123}`.",
|
|
10537
10968
|
"recordingAsset.confirm --arrived": "One or more JSON objects shaped `{\"url\":\"https://…\",\"etag\":\"…\",\"byteSize\":123}`.",
|
|
10538
10969
|
"screen.create --client-token": "Client-minted capture UUID; reuse it when retrying the same screen reservation.",
|
|
10970
|
+
"screen.create --is-recording-mark": "Defaults to true for recording marks. Use false for an explicit canvas capture that retains recording provenance without adding a recording mark.",
|
|
10539
10971
|
"screen.create --provenance": "Required origin JSON `{\"sourceRecordingId\":\"UUID\",\"atMs\":0}`, or the literal null.",
|
|
10540
10972
|
"screen.create --route": "Required original page route, or the literal null.",
|
|
10541
10973
|
"screen.create --page-title": "Required captured page title, or the literal null.",
|
|
@@ -10739,37 +11171,26 @@ const PROFILE_DRAFT_POLICY = {
|
|
|
10739
11171
|
owner: "product",
|
|
10740
11172
|
reason: "Profile upload and atomic Save belong to the Settings draft lifecycle."
|
|
10741
11173
|
};
|
|
11174
|
+
const CAPTURE_PIPELINE_POLICY = {
|
|
11175
|
+
exposure: "internal",
|
|
11176
|
+
owner: "product",
|
|
11177
|
+
reason: "Capture reservation, publication and baseline promotion belong to explicit SDK pipeline callers."
|
|
11178
|
+
};
|
|
10742
11179
|
const PROCEDURE_CAPABILITY_POLICIES = {
|
|
10743
|
-
"captureRun.
|
|
10744
|
-
|
|
10745
|
-
owner: "product",
|
|
10746
|
-
reason: "The SDK reserves capture baselines before tests execute."
|
|
10747
|
-
},
|
|
10748
|
-
"captureRun.get": {
|
|
10749
|
-
exposure: "internal",
|
|
10750
|
-
owner: "product",
|
|
10751
|
-
reason: "SDK publication owns run and receipt recovery."
|
|
10752
|
-
},
|
|
10753
|
-
"captureRun.reserveAssets": {
|
|
10754
|
-
exposure: "internal",
|
|
10755
|
-
owner: "product",
|
|
10756
|
-
reason: "The SDK verifies and uploads immutable capture artifacts."
|
|
10757
|
-
},
|
|
10758
|
-
"captureRun.seal": {
|
|
10759
|
-
exposure: "internal",
|
|
10760
|
-
owner: "product",
|
|
10761
|
-
reason: "The SDK seals complete successful attempts before publication."
|
|
10762
|
-
},
|
|
10763
|
-
"captureRun.publish": {
|
|
10764
|
-
exposure: "internal",
|
|
10765
|
-
owner: "product",
|
|
10766
|
-
reason: "Capture publication is composed by the SDK and captures publish command."
|
|
10767
|
-
},
|
|
10768
|
-
"captureRun.cancel": {
|
|
11180
|
+
"captureRun.review": SHARED_CAPABILITY_POLICY,
|
|
11181
|
+
"captureRun.decide": {
|
|
10769
11182
|
exposure: "internal",
|
|
10770
11183
|
owner: "product",
|
|
10771
|
-
reason: "
|
|
11184
|
+
reason: "Whole-run decisions belong to canvas review and explicit SDK callers."
|
|
10772
11185
|
},
|
|
11186
|
+
"captureRun.reference": CAPTURE_PIPELINE_POLICY,
|
|
11187
|
+
"captureRun.promote": CAPTURE_PIPELINE_POLICY,
|
|
11188
|
+
"captureRun.begin": CAPTURE_PIPELINE_POLICY,
|
|
11189
|
+
"captureRun.get": CAPTURE_PIPELINE_POLICY,
|
|
11190
|
+
"captureRun.reserveAssets": CAPTURE_PIPELINE_POLICY,
|
|
11191
|
+
"captureRun.seal": CAPTURE_PIPELINE_POLICY,
|
|
11192
|
+
"captureRun.publish": CAPTURE_PIPELINE_POLICY,
|
|
11193
|
+
"captureRun.cancel": CAPTURE_PIPELINE_POLICY,
|
|
10773
11194
|
"captureRun.comparison": {
|
|
10774
11195
|
exposure: "internal",
|
|
10775
11196
|
owner: "product",
|
|
@@ -11023,6 +11444,7 @@ const SHARED_CAPABILITY_PROCEDURES = /* @__PURE__ */ new Set([
|
|
|
11023
11444
|
"organisation.people.add",
|
|
11024
11445
|
"organisation.people.list",
|
|
11025
11446
|
"organisation.people.remove",
|
|
11447
|
+
"organisation.people.setContentAccess",
|
|
11026
11448
|
"organisation.people.setRole",
|
|
11027
11449
|
"organisation.people.transferOwnership",
|
|
11028
11450
|
"organisation.update",
|
|
@@ -11418,7 +11840,7 @@ const fieldMessage = (issue) => {
|
|
|
11418
11840
|
return `Check ${label.toLowerCase()} and try again.`;
|
|
11419
11841
|
};
|
|
11420
11842
|
/**
|
|
11421
|
-
* @justified
|
|
11843
|
+
* @justified warning
|
|
11422
11844
|
* A schema failure, flattened to `{ path: reason }`.
|
|
11423
11845
|
*
|
|
11424
11846
|
* Without this the caller receives a serialised issue list crammed into `message` — a JSON blob
|
|
@@ -11436,7 +11858,7 @@ const fieldsOf$2 = (cause) => {
|
|
|
11436
11858
|
};
|
|
11437
11859
|
};
|
|
11438
11860
|
/**
|
|
11439
|
-
* @justified
|
|
11861
|
+
* @justified warning
|
|
11440
11862
|
* Rebuilt field by field rather than passed through, and INTERNAL loses its message.
|
|
11441
11863
|
*
|
|
11442
11864
|
* Two separate reasons for the two halves. Rebuilt, because tRPC turns a thrown `cause` into an
|
|
@@ -11490,7 +11912,6 @@ const toTrpcError = (error) => new TRPCError({
|
|
|
11490
11912
|
message: error.message,
|
|
11491
11913
|
cause: error
|
|
11492
11914
|
});
|
|
11493
|
-
const TOO_LARGE = appError("BAD_REQUEST", "this change is too large to save", { reason: REQUEST_TOO_LARGE });
|
|
11494
11915
|
|
|
11495
11916
|
//#endregion
|
|
11496
11917
|
//#region ../api/src/shared/trpc/idempotency.procedure.ts
|
|
@@ -11585,7 +12006,7 @@ const failureOf = (error) => {
|
|
|
11585
12006
|
};
|
|
11586
12007
|
};
|
|
11587
12008
|
/**
|
|
11588
|
-
* @justified
|
|
12009
|
+
* @justified amplification
|
|
11589
12010
|
* The canonical line: one per procedure call, and the whole of the profile.
|
|
11590
12011
|
*
|
|
11591
12012
|
* `queryCount` is on it deliberately. An N+1 is invisible in a latency graph until it is a
|
|
@@ -11642,7 +12063,7 @@ const renderGrantScope = trpcMiddleware(async ({ ctx, path, next }) => {
|
|
|
11642
12063
|
return next();
|
|
11643
12064
|
});
|
|
11644
12065
|
/**
|
|
11645
|
-
* @justified
|
|
12066
|
+
* @justified intent
|
|
11646
12067
|
* A credential that was presented and failed is refused here, for every procedure, before any
|
|
11647
12068
|
* reach check can answer. Read as anonymous, it turned an expired session into "no such canvas"
|
|
11648
12069
|
* on a private canvas and into a quietly public read on a shared one.
|
|
@@ -11711,6 +12132,17 @@ const withAccess = trpcMiddleware(async ({ ctx, getRawInput, next }) => {
|
|
|
11711
12132
|
} });
|
|
11712
12133
|
});
|
|
11713
12134
|
const canvasReaderProcedure = baseProcedure.use(withAccess);
|
|
12135
|
+
const canvasPersonReaderProcedure = canvasReaderProcedure.use(async ({ ctx, next }) => {
|
|
12136
|
+
if (ctx.viewer.kind === "anonymous" || ctx.viewer.kind === "render") throw toTrpcError(appError$1("UNAUTHORIZED", "this call needs a signed-in person"));
|
|
12137
|
+
return next({ ctx: {
|
|
12138
|
+
...ctx,
|
|
12139
|
+
viewer: ctx.viewer
|
|
12140
|
+
} });
|
|
12141
|
+
});
|
|
12142
|
+
const canvasEditorProcedure = canvasPersonReaderProcedure.use(async ({ ctx, next }) => {
|
|
12143
|
+
if (!ctx.canvasAccess.canEdit) throw toTrpcError(appError$1("FORBIDDEN", "this canvas is read-only for you"));
|
|
12144
|
+
return next();
|
|
12145
|
+
});
|
|
11714
12146
|
const canvasHistoryReaderProcedure = canvasReaderProcedure.use(async ({ ctx, next }) => {
|
|
11715
12147
|
if (!ctx.canvasAccess.canSeeRoutes || ctx.viewer.kind === "anonymous" || ctx.viewer.kind === "render") throw toTrpcError(appError$1("NOT_FOUND", "no such canvas"));
|
|
11716
12148
|
return next({ ctx: {
|
|
@@ -11722,7 +12154,7 @@ const canvasHistoryReaderProcedure = canvasReaderProcedure.use(async ({ ctx, nex
|
|
|
11722
12154
|
const agentCanvasReaderProcedure = agentProcedure.use(withAccess);
|
|
11723
12155
|
/** Agent-token editing authority, kept separate from browser sessions and read-only agent reach. */
|
|
11724
12156
|
const agentCanvasEditorProcedure = agentCanvasReaderProcedure.use(async ({ ctx, next }) => {
|
|
11725
|
-
if (!ctx.canvasAccess.
|
|
12157
|
+
if (!ctx.canvasAccess.canEdit) throw toTrpcError(appError$1("FORBIDDEN", "this canvas is read-only for you"));
|
|
11726
12158
|
return next({ ctx: {
|
|
11727
12159
|
...ctx,
|
|
11728
12160
|
viewer: ctx.viewer
|
|
@@ -11836,6 +12268,9 @@ const toCanvasContract = (view) => ({
|
|
|
11836
12268
|
viewerCan: {
|
|
11837
12269
|
read: view.reach.canRead,
|
|
11838
12270
|
comment: view.reach.canComment ? "yes" : view.reach.commentNeedsSignIn ? "sign-in" : "no",
|
|
12271
|
+
edit: view.reach.canEdit ? "yes" : view.reach.editNeedsSignIn ? "sign-in" : "no",
|
|
12272
|
+
grants: [...view.reach.grants],
|
|
12273
|
+
grantableAccessLevels: [...view.reach.grantableAccessLevels],
|
|
11839
12274
|
share: view.reach.canShare,
|
|
11840
12275
|
manage: view.reach.canManage
|
|
11841
12276
|
},
|
|
@@ -11880,6 +12315,8 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
|
11880
12315
|
styles: { ...node.styles },
|
|
11881
12316
|
...node.layout !== void 0 && { layout: node.layout },
|
|
11882
12317
|
...node.appearance !== void 0 && { appearance: node.appearance },
|
|
12318
|
+
...node.geometry !== void 0 && { geometry: node.geometry },
|
|
12319
|
+
...node.compositing !== void 0 && { compositing: node.compositing },
|
|
11883
12320
|
...node.typography !== void 0 && { typography: node.typography },
|
|
11884
12321
|
...node.additionalStyles !== void 0 && { additionalStyles: node.additionalStyles },
|
|
11885
12322
|
...node.props !== void 0 && { props: { ...node.props } },
|
|
@@ -11888,7 +12325,7 @@ const toCanvasSceneNodeContract = (node) => canvasSceneNodeSchema.parse({
|
|
|
11888
12325
|
|
|
11889
12326
|
//#endregion
|
|
11890
12327
|
//#region ../api/src/canvas/infrastructure/canvas.router.ts
|
|
11891
|
-
const applyOperations = (handlers) =>
|
|
12328
|
+
const applyOperations = (handlers) => canvasEditorProcedure.input(applyCanvasOperationsInputSchema).output(applyCanvasOperationsOutputSchema).mutation(async ({ input, ctx }) => {
|
|
11892
12329
|
const applied = orThrow(await handlers.applyOperations.execute({
|
|
11893
12330
|
...input,
|
|
11894
12331
|
personId: ctx.viewer.personId,
|
|
@@ -11906,7 +12343,7 @@ const applyOperations = (handlers) => canvasCommenterProcedure.input(applyCanvas
|
|
|
11906
12343
|
next: [`enhance canvas tree --canvas ${applied.canvasId}`, ...renderNext]
|
|
11907
12344
|
};
|
|
11908
12345
|
});
|
|
11909
|
-
const createEditableFrame = (handlers) =>
|
|
12346
|
+
const createEditableFrame = (handlers) => canvasEditorProcedure.meta({ description: "Atomically insert a validated editable frame subtree beside an existing screen." }).input(createEditableFrameInputSchema).output(createEditableFrameOutputSchema).mutation(async ({ input, ctx }) => {
|
|
11910
12347
|
const created = orThrow(await handlers.createEditableFrame.execute({
|
|
11911
12348
|
...input,
|
|
11912
12349
|
destination: { kind: "adjacent" },
|
|
@@ -11964,7 +12401,10 @@ const get$3 = (handlers) => canvasReaderProcedure.input(getCanvasInputSchema).ou
|
|
|
11964
12401
|
return toCanvasContract(view);
|
|
11965
12402
|
});
|
|
11966
12403
|
const setAccess = (handlers) => canvasOwnerProcedure.input(setCanvasAccessInputSchema).output(setCanvasAccessOutputSchema).mutation(async ({ input, ctx }) => {
|
|
11967
|
-
const result = orThrow(await handlers.setAccess.execute(
|
|
12404
|
+
const result = orThrow(await handlers.setAccess.execute({
|
|
12405
|
+
...input,
|
|
12406
|
+
personId: ctx.viewer.personId
|
|
12407
|
+
}));
|
|
11968
12408
|
ctx.telemetry.emit("AccessStateChanged", {
|
|
11969
12409
|
canvasId: input.canvasId,
|
|
11970
12410
|
fromState: ctx.canvasAccess.accessState,
|
|
@@ -12008,7 +12448,10 @@ const createCanvasRouter = (handlers) => trpcRouter({
|
|
|
12008
12448
|
}),
|
|
12009
12449
|
rename: canvasOwnerProcedure.input(renameCanvasInputSchema).output(canvasSchema).mutation(async ({ input, ctx }) => {
|
|
12010
12450
|
return toCanvasContract({
|
|
12011
|
-
canvas: orThrow(await handlers.rename.execute(
|
|
12451
|
+
canvas: orThrow(await handlers.rename.execute({
|
|
12452
|
+
...input,
|
|
12453
|
+
personId: ctx.viewer.personId
|
|
12454
|
+
})),
|
|
12012
12455
|
accessLevel: ctx.canvasAccess.accessLevel,
|
|
12013
12456
|
reach: ctx.canvasAccess,
|
|
12014
12457
|
unresolvedCount: 0
|
|
@@ -12593,7 +13036,7 @@ const createCanvasChatRouter = (handlers) => trpcRouter({
|
|
|
12593
13036
|
//#endregion
|
|
12594
13037
|
//#region ../api/src/canvas/infrastructure/canvas-document.router.ts
|
|
12595
13038
|
/**
|
|
12596
|
-
* @justified
|
|
13039
|
+
* @justified intent
|
|
12597
13040
|
* The cold open and the save: the only two procedures in this surface that carry the
|
|
12598
13041
|
* document itself.
|
|
12599
13042
|
*
|
|
@@ -12637,7 +13080,7 @@ const getDocument = (handlers) => canvasReaderProcedure.input(getCanvasDocumentI
|
|
|
12637
13080
|
}))
|
|
12638
13081
|
};
|
|
12639
13082
|
});
|
|
12640
|
-
const saveDocument = (handlers) =>
|
|
13083
|
+
const saveDocument = (handlers) => canvasEditorProcedure.input(saveCanvasDocumentInputSchema).output(saveCanvasDocumentOutputSchema).mutation(async ({ input, ctx }) => {
|
|
12641
13084
|
const result = orThrow(await handlers.saveDocument.execute({
|
|
12642
13085
|
canvasId: input.canvasId,
|
|
12643
13086
|
personId: ctx.viewer.personId,
|
|
@@ -12671,7 +13114,7 @@ const createCanvasDocumentRouter = (handlers) => trpcRouter({
|
|
|
12671
13114
|
//#endregion
|
|
12672
13115
|
//#region ../api/src/canvas/infrastructure/canvas-font.router.ts
|
|
12673
13116
|
const createCanvasFontRouter = (handlers) => trpcRouter({
|
|
12674
|
-
copyFonts:
|
|
13117
|
+
copyFonts: canvasEditorProcedure.meta({ description: "Copy readable file fonts into this canvas before publishing pasted content." }).input(copyCanvasFontsInputSchema).output(copyCanvasFontsOutputSchema).mutation(async ({ input, ctx }) => {
|
|
12675
13118
|
return { resources: orThrow(await handlers.fonts.copy({
|
|
12676
13119
|
...input,
|
|
12677
13120
|
viewer: ctx.viewer
|
|
@@ -12680,7 +13123,7 @@ const createCanvasFontRouter = (handlers) => trpcRouter({
|
|
|
12680
13123
|
path: canvasFontAssetPath(input.canvasId, source.sha256)
|
|
12681
13124
|
})) };
|
|
12682
13125
|
}),
|
|
12683
|
-
reserveFont:
|
|
13126
|
+
reserveFont: canvasEditorProcedure.meta({ description: "Reserve a file-scoped font upload pinned to its SHA-256 digest." }).input(reserveCanvasFontInputSchema).output(reserveCanvasFontOutputSchema).mutation(async ({ input }) => {
|
|
12684
13127
|
const upload = orThrow(await handlers.fonts.reserve(input));
|
|
12685
13128
|
return {
|
|
12686
13129
|
path: canvasFontAssetPath(input.canvasId, input.sha256),
|
|
@@ -12690,7 +13133,7 @@ const createCanvasFontRouter = (handlers) => trpcRouter({
|
|
|
12690
13133
|
}
|
|
12691
13134
|
};
|
|
12692
13135
|
}),
|
|
12693
|
-
completeFont:
|
|
13136
|
+
completeFont: canvasEditorProcedure.meta({ description: "Verify that the exact font bytes have arrived before using the resource." }).input(completeCanvasFontInputSchema).output(completeCanvasFontOutputSchema).mutation(async ({ input }) => {
|
|
12694
13137
|
orThrow(await handlers.fonts.complete(input));
|
|
12695
13138
|
return { path: canvasFontAssetPath(input.canvasId, input.sha256) };
|
|
12696
13139
|
})
|
|
@@ -12698,7 +13141,7 @@ const createCanvasFontRouter = (handlers) => trpcRouter({
|
|
|
12698
13141
|
|
|
12699
13142
|
//#endregion
|
|
12700
13143
|
//#region ../api/src/canvas/infrastructure/canvas-image.router.ts
|
|
12701
|
-
const createCanvasImageRouter = (handlers) => trpcRouter({ reserveImage:
|
|
13144
|
+
const createCanvasImageRouter = (handlers) => trpcRouter({ reserveImage: canvasEditorProcedure.meta({ description: "Reserve storage and upload instructions for one canvas image." }).input(reserveCanvasImageInputSchema).output(reserveCanvasImageOutputSchema).mutation(async ({ input }) => {
|
|
12702
13145
|
const reserved = orThrow(await handlers.reserveImage.execute(input));
|
|
12703
13146
|
return {
|
|
12704
13147
|
...reserved,
|
|
@@ -12876,6 +13319,8 @@ const createCanvasInspectionRouter = (handlers, webOrigin) => ({
|
|
|
12876
13319
|
styles: found.node.styles,
|
|
12877
13320
|
...found.node.layout !== void 0 && { layout: found.node.layout },
|
|
12878
13321
|
...found.node.appearance !== void 0 && { appearance: found.node.appearance },
|
|
13322
|
+
...found.node.geometry !== void 0 && { geometry: found.node.geometry },
|
|
13323
|
+
...found.node.compositing !== void 0 && { compositing: found.node.compositing },
|
|
12879
13324
|
...found.node.typography !== void 0 && { typography: found.node.typography },
|
|
12880
13325
|
...found.node.additionalStyles !== void 0 && { additionalStyles: found.node.additionalStyles },
|
|
12881
13326
|
props: found.node.props ?? {},
|
|
@@ -12970,9 +13415,15 @@ const createCanvasInviteRouter = (handlers, shouldExposeTokens = false) => trpcR
|
|
|
12970
13415
|
truncated: false
|
|
12971
13416
|
};
|
|
12972
13417
|
}),
|
|
12973
|
-
revoke: canvasOwnerProcedure.input(revokeInviteInputSchema).output(revokeInviteInputSchema.pick({ inviteId: true })).mutation(async ({ input }) => orThrow(await handlers.revokeInvite.execute(
|
|
12974
|
-
|
|
12975
|
-
|
|
13418
|
+
revoke: canvasOwnerProcedure.input(revokeInviteInputSchema).output(revokeInviteInputSchema.pick({ inviteId: true })).mutation(async ({ input, ctx }) => orThrow(await handlers.revokeInvite.execute({
|
|
13419
|
+
...input,
|
|
13420
|
+
personId: ctx.viewer.personId
|
|
13421
|
+
}))),
|
|
13422
|
+
resend: canvasOwnerProcedure.input(resendInviteInputSchema).output(createInviteOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13423
|
+
const result = orThrow(await handlers.resendInvite.execute({
|
|
13424
|
+
...input,
|
|
13425
|
+
personId: ctx.viewer.personId
|
|
13426
|
+
}));
|
|
12976
13427
|
return {
|
|
12977
13428
|
invite: toInviteContract(result.invite, /* @__PURE__ */ new Date()),
|
|
12978
13429
|
...shouldExposeTokens && { acceptToken: result.token }
|
|
@@ -13020,10 +13471,12 @@ const createCanvasLifecycleRouter = (handlers) => trpcRouter({
|
|
|
13020
13471
|
|
|
13021
13472
|
//#endregion
|
|
13022
13473
|
//#region ../api/src/canvas/infrastructure/canvas-mutation.router.ts
|
|
13023
|
-
const createCanvasMutationRouter = (handler) => trpcRouter({ get:
|
|
13474
|
+
const createCanvasMutationRouter = (handler) => trpcRouter({ get: canvasPersonReaderProcedure.input(getCanvasMutationInputSchema.partial({ fingerprint: true })).output(getCanvasMutationOutputSchema).query(async ({ input, ctx }) => {
|
|
13475
|
+
if (input.fingerprint === void 0 && ctx.viewer.kind !== "person") throw toTrpcError(appError$1("BAD_REQUEST", "A request fingerprint is required."));
|
|
13024
13476
|
const commit = orThrow(await handler.execute({
|
|
13025
13477
|
...input,
|
|
13026
|
-
personId: ctx.viewer.personId
|
|
13478
|
+
personId: ctx.viewer.personId,
|
|
13479
|
+
...input.fingerprint === void 0 && { actorKind: "person" }
|
|
13027
13480
|
}));
|
|
13028
13481
|
if (commit === null) return { state: "not-found" };
|
|
13029
13482
|
return {
|
|
@@ -13047,7 +13500,6 @@ const createCanvasMutationRouter = (handler) => trpcRouter({ get: canvasCommente
|
|
|
13047
13500
|
|
|
13048
13501
|
//#endregion
|
|
13049
13502
|
//#region ../api/src/canvas/infrastructure/canvas-mutation-recovery.router.ts
|
|
13050
|
-
const MAX_TURN_MUTATIONS = 1e3;
|
|
13051
13503
|
const receiptSchema$1 = applyCanvasOperationsOutputSchema.pick({
|
|
13052
13504
|
canvasId: true,
|
|
13053
13505
|
mutationId: true,
|
|
@@ -13058,9 +13510,9 @@ const receiptSchema$1 = applyCanvasOperationsOutputSchema.pick({
|
|
|
13058
13510
|
removedNodeIds: true
|
|
13059
13511
|
}).extend({ review: canvasMutationReviewSchema });
|
|
13060
13512
|
const createCanvasMutationRecoveryRouter = (handlers) => trpcRouter({
|
|
13061
|
-
revertMutations:
|
|
13513
|
+
revertMutations: canvasEditorProcedure.input(z.object({
|
|
13062
13514
|
canvasId: z.uuid(),
|
|
13063
|
-
mutationIds: z.array(z.uuid()).min(1)
|
|
13515
|
+
mutationIds: z.array(z.uuid()).min(1),
|
|
13064
13516
|
reversalId: z.uuid()
|
|
13065
13517
|
})).output(applyCanvasOperationsOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13066
13518
|
const result = orThrow(await handlers.mutationRecovery.undo({
|
|
@@ -13076,7 +13528,7 @@ const createCanvasMutationRecoveryRouter = (handlers) => trpcRouter({
|
|
|
13076
13528
|
next: []
|
|
13077
13529
|
};
|
|
13078
13530
|
}),
|
|
13079
|
-
mutationReceipt:
|
|
13531
|
+
mutationReceipt: canvasPersonReaderProcedure.input(z.object({
|
|
13080
13532
|
canvasId: z.uuid(),
|
|
13081
13533
|
mutationId: z.uuid()
|
|
13082
13534
|
})).output(receiptSchema$1.nullable()).query(async ({ input, ctx }) => {
|
|
@@ -13126,14 +13578,20 @@ const createCanvasParticipantRouter = (handlers) => trpcRouter({
|
|
|
13126
13578
|
setAccess: canvasOwnerProcedure.input(setParticipantAccessInputSchema).output(setParticipantAccessInputSchema.pick({
|
|
13127
13579
|
personId: true,
|
|
13128
13580
|
accessLevel: true
|
|
13129
|
-
})).mutation(async ({ input }) => {
|
|
13130
|
-
orThrow(await handlers.setParticipantAccess.execute(
|
|
13581
|
+
})).mutation(async ({ input, ctx }) => {
|
|
13582
|
+
orThrow(await handlers.setParticipantAccess.execute({
|
|
13583
|
+
...input,
|
|
13584
|
+
actorPersonId: ctx.viewer.personId
|
|
13585
|
+
}));
|
|
13131
13586
|
return {
|
|
13132
13587
|
personId: input.personId,
|
|
13133
13588
|
accessLevel: input.accessLevel
|
|
13134
13589
|
};
|
|
13135
13590
|
}),
|
|
13136
|
-
revoke: canvasOwnerProcedure.input(revokeParticipantInputSchema).output(revokeParticipantOutputSchema).mutation(async ({ input }) => orThrow(await handlers.revokeParticipant.execute(
|
|
13591
|
+
revoke: canvasOwnerProcedure.input(revokeParticipantInputSchema).output(revokeParticipantOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.revokeParticipant.execute({
|
|
13592
|
+
...input,
|
|
13593
|
+
actorPersonId: ctx.viewer.personId
|
|
13594
|
+
})))
|
|
13137
13595
|
});
|
|
13138
13596
|
|
|
13139
13597
|
//#endregion
|
|
@@ -13229,14 +13687,14 @@ const agentActor = (viewer) => {
|
|
|
13229
13687
|
tokenId: viewer.tokenId
|
|
13230
13688
|
};
|
|
13231
13689
|
};
|
|
13232
|
-
const assertActivityAccess = (phase,
|
|
13233
|
-
if (
|
|
13690
|
+
const assertActivityAccess = (phase, canEdit) => {
|
|
13691
|
+
if (canEdit || phase === "reading" || phase === "rendering") return;
|
|
13234
13692
|
throw toTrpcError(appError("FORBIDDEN", "this canvas is read-only for you"));
|
|
13235
13693
|
};
|
|
13236
13694
|
const createCanvasActivityRouter = (activity) => trpcRouter({
|
|
13237
13695
|
begin: agentCanvasReaderProcedure.input(beginCanvasActivityInputSchema).output(beginCanvasActivityOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13238
13696
|
if (ctx.viewer.kind !== "agent") throw new TypeError("agent identity was not narrowed");
|
|
13239
|
-
assertActivityAccess(input.phase, ctx.canvasAccess.
|
|
13697
|
+
assertActivityAccess(input.phase, ctx.canvasAccess.canEdit);
|
|
13240
13698
|
const started = orThrow(await activity.begin({
|
|
13241
13699
|
...input,
|
|
13242
13700
|
actor: agentActor(ctx.viewer)
|
|
@@ -13249,7 +13707,7 @@ const createCanvasActivityRouter = (activity) => trpcRouter({
|
|
|
13249
13707
|
}),
|
|
13250
13708
|
renew: agentCanvasReaderProcedure.input(renewCanvasActivityInputSchema).output(beginCanvasActivityOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13251
13709
|
if (ctx.viewer.kind !== "agent") throw new TypeError("agent identity was not narrowed");
|
|
13252
|
-
assertActivityAccess(input.phase, ctx.canvasAccess.
|
|
13710
|
+
assertActivityAccess(input.phase, ctx.canvasAccess.canEdit);
|
|
13253
13711
|
const renewed = orThrow(await activity.renew({
|
|
13254
13712
|
...input,
|
|
13255
13713
|
actor: agentActor(ctx.viewer)
|
|
@@ -13390,6 +13848,7 @@ const toCanvasVersionContractEntry = (entry) => ({
|
|
|
13390
13848
|
actor: entry.actor,
|
|
13391
13849
|
sourceVersionEntryId: entry.sourceVersionEntryId,
|
|
13392
13850
|
expiresAt: entry.expiresAt?.toISOString() ?? null,
|
|
13851
|
+
checkpointAt: entry.checkpointAt.toISOString(),
|
|
13393
13852
|
createdAt: entry.createdAt.toISOString(),
|
|
13394
13853
|
updatedAt: entry.updatedAt.toISOString(),
|
|
13395
13854
|
screenCount: entry.screenCount
|
|
@@ -13450,14 +13909,14 @@ const get$2 = (handlers) => canvasHistoryReaderProcedure.input(getCanvasVersionI
|
|
|
13450
13909
|
screens: result.screens.map((screen) => toCanvasVersionContractScreen(screen))
|
|
13451
13910
|
};
|
|
13452
13911
|
});
|
|
13453
|
-
const name = (handlers) =>
|
|
13912
|
+
const name = (handlers) => canvasEditorProcedure.input(nameCanvasVersionInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13454
13913
|
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
13455
13914
|
...input,
|
|
13456
13915
|
actor: toCanvasVersionActor(ctx.viewer),
|
|
13457
13916
|
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
13458
13917
|
}))) };
|
|
13459
13918
|
});
|
|
13460
|
-
const updateMetadata = (handlers) =>
|
|
13919
|
+
const updateMetadata = (handlers) => canvasEditorProcedure.input(updateCanvasVersionMetadataInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13461
13920
|
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.name({
|
|
13462
13921
|
canvasId: input.canvasId,
|
|
13463
13922
|
target: {
|
|
@@ -13470,14 +13929,14 @@ const updateMetadata = (handlers) => canvasCommenterProcedure.input(updateCanvas
|
|
|
13470
13929
|
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
13471
13930
|
}))) };
|
|
13472
13931
|
});
|
|
13473
|
-
const removeName = (handlers) =>
|
|
13932
|
+
const removeName = (handlers) => canvasEditorProcedure.input(removeCanvasVersionNameInputSchema).output(canvasVersionMutationOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13474
13933
|
return { entry: toCanvasVersionContractEntry(orThrow(await handlers.versions.removeName({
|
|
13475
13934
|
...input,
|
|
13476
13935
|
requesterPersonId: ctx.viewer.personId,
|
|
13477
13936
|
canManageAllMetadata: ctx.canvasAccess.canManage
|
|
13478
13937
|
}))) };
|
|
13479
13938
|
});
|
|
13480
|
-
const restore = (handlers) =>
|
|
13939
|
+
const restore = (handlers) => canvasEditorProcedure.input(restoreCanvasVersionInputSchema).output(restoreCanvasVersionOutputSchema).mutation(async ({ input, ctx }) => {
|
|
13481
13940
|
if (ctx.viewer.kind !== "person") throw toTrpcError(appError("FORBIDDEN", "an agent cannot restore canvas history"));
|
|
13482
13941
|
const restored = orThrow(await handlers.versions.restore({
|
|
13483
13942
|
...input,
|
|
@@ -13530,6 +13989,45 @@ const captureComparisonSchema = z.strictObject({
|
|
|
13530
13989
|
after: preview$1
|
|
13531
13990
|
});
|
|
13532
13991
|
|
|
13992
|
+
//#endregion
|
|
13993
|
+
//#region ../../packages/contract/src/capture/capture-review.schema.ts
|
|
13994
|
+
const captureReviewInputSchema = z.strictObject({ canvasId: z.uuid() });
|
|
13995
|
+
const setCaptureVerdictInputSchema = captureReviewInputSchema.extend({ verdict: captureVerdictSchema });
|
|
13996
|
+
const captureReferenceInputSchema = z.strictObject({
|
|
13997
|
+
canvasId: z.uuid(),
|
|
13998
|
+
name: z.string().min(1)
|
|
13999
|
+
});
|
|
14000
|
+
const captureReferenceSchema = z.strictObject({
|
|
14001
|
+
runId: z.uuid(),
|
|
14002
|
+
revision: z.string(),
|
|
14003
|
+
version: z.number().int().positive()
|
|
14004
|
+
});
|
|
14005
|
+
const updateCaptureReferenceInputSchema = captureReferenceInputSchema.extend({
|
|
14006
|
+
expectedVersion: z.number().int().nonnegative(),
|
|
14007
|
+
revision: z.string().min(1)
|
|
14008
|
+
});
|
|
14009
|
+
const captureReviewSchema = z.strictObject({
|
|
14010
|
+
current: getCaptureRunOutputSchema,
|
|
14011
|
+
latest: captureRunDescriptorSchema,
|
|
14012
|
+
related: z.array(z.strictObject({
|
|
14013
|
+
run: captureRunDescriptorSchema,
|
|
14014
|
+
verdict: captureVerdictSchema
|
|
14015
|
+
})),
|
|
14016
|
+
changes: z.array(z.strictObject({
|
|
14017
|
+
key: captureKeySchema,
|
|
14018
|
+
frameId: z.string(),
|
|
14019
|
+
label: z.string(),
|
|
14020
|
+
journeyLabel: z.string(),
|
|
14021
|
+
page: z.string().optional(),
|
|
14022
|
+
change: z.enum([
|
|
14023
|
+
"new",
|
|
14024
|
+
"changed",
|
|
14025
|
+
"unchanged",
|
|
14026
|
+
"uncompared"
|
|
14027
|
+
])
|
|
14028
|
+
}))
|
|
14029
|
+
});
|
|
14030
|
+
|
|
13533
14031
|
//#endregion
|
|
13534
14032
|
//#region ../api/src/canvas/infrastructure/capture-run.router.ts
|
|
13535
14033
|
const actorOf$1 = (viewer) => {
|
|
@@ -13540,8 +14038,18 @@ const actorOf$1 = (viewer) => {
|
|
|
13540
14038
|
tokenId: actor.tokenId
|
|
13541
14039
|
};
|
|
13542
14040
|
};
|
|
14041
|
+
const reviewProcedures = (review, comparison) => ({
|
|
14042
|
+
comparison: canvasHistoryReaderProcedure.input(captureComparisonInputSchema).output(captureComparisonSchema.nullable()).query(async ({ input }) => orThrow(await comparison(input))),
|
|
14043
|
+
review: canvasHistoryReaderProcedure.input(captureReviewInputSchema).output(captureReviewSchema.nullable()).query(async ({ input, ctx }) => captureReviewSchema.nullable().parse(orThrow(await review.read(input.canvasId, ctx.viewer)))),
|
|
14044
|
+
decide: canvasEditorProcedure.input(setCaptureVerdictInputSchema).output(z.object({ accepted: z.literal(true) })).mutation(async ({ input, ctx }) => {
|
|
14045
|
+
orThrow(await review.decide(input.canvasId, input.verdict, ctx.viewer.personId));
|
|
14046
|
+
return { accepted: true };
|
|
14047
|
+
}),
|
|
14048
|
+
reference: agentCanvasEditorProcedure.input(captureReferenceInputSchema).output(captureReferenceSchema.nullable()).query(async ({ input }) => orThrow(await review.reference(input.canvasId, input.name))),
|
|
14049
|
+
promote: agentCanvasEditorProcedure.input(updateCaptureReferenceInputSchema).output(captureReferenceSchema).mutation(async ({ input, ctx }) => orThrow(await review.promote(input, actorOf$1(ctx.viewer).mutation.personId)))
|
|
14050
|
+
});
|
|
13543
14051
|
const createCaptureRunRouter = (capture) => trpcRouter({
|
|
13544
|
-
|
|
14052
|
+
...reviewProcedures(capture.review, capture.comparison),
|
|
13545
14053
|
begin: agentProcedure.input(beginCaptureRunInputSchema).output(beginCaptureRunOutputSchema).mutation(async ({ input, ctx }) => ({ run: beginCaptureRunOutputSchema.shape.run.parse(orThrow(await capture.begin(input, actorOf$1(ctx.viewer))).run) })),
|
|
13546
14054
|
get: agentProcedure.input(getCaptureRunInputSchema).output(getCaptureRunOutputSchema).query(async ({ input, ctx }) => getCaptureRunOutputSchema.parse(orThrow(await capture.get(input.runId, actorOf$1(ctx.viewer))))),
|
|
13547
14055
|
reserveAssets: agentProcedure.input(reserveCaptureBlobsInputSchema).output(reserveCaptureBlobsOutputSchema).mutation(async ({ input, ctx }) => reserveCaptureBlobsOutputSchema.parse(orThrow(await capture.reserve(input, actorOf$1(ctx.viewer))))),
|
|
@@ -13903,6 +14411,10 @@ const downloadRender = (handlers) => agentProcedure.input(downloadCanvasRenderIn
|
|
|
13903
14411
|
}));
|
|
13904
14412
|
return {
|
|
13905
14413
|
jobId: input.jobId,
|
|
14414
|
+
source: download.source.status === "available" ? {
|
|
14415
|
+
...download.source,
|
|
14416
|
+
prototypes: [...download.source.prototypes]
|
|
14417
|
+
} : download.source,
|
|
13906
14418
|
download: {
|
|
13907
14419
|
url: download.url,
|
|
13908
14420
|
expiresAt: download.expiresAt.toISOString(),
|
|
@@ -14178,7 +14690,7 @@ const authorFrom = (viewer) => ({
|
|
|
14178
14690
|
initials: viewer.initials
|
|
14179
14691
|
});
|
|
14180
14692
|
/**
|
|
14181
|
-
* @justified
|
|
14693
|
+
* @justified warning
|
|
14182
14694
|
* What is worth writing down about an anchor: whether it names a source file, which is the
|
|
14183
14695
|
* only thing that makes a thread actionable, and how deep its selector reaches.
|
|
14184
14696
|
*
|
|
@@ -14207,7 +14719,7 @@ const start$1 = (handlers) => canvasCommenterProcedure.input(startCommentInputSc
|
|
|
14207
14719
|
body: input.body,
|
|
14208
14720
|
mentionedPersonIds: input.mentionedPersonIds,
|
|
14209
14721
|
author: authorFrom(ctx.viewer),
|
|
14210
|
-
mintMembership: ctx.canvasAccess.accessLevel === null
|
|
14722
|
+
mintMembership: ctx.canvasAccess.accessLevel === null && ctx.canvasAccess.accessState === "link-comment"
|
|
14211
14723
|
}));
|
|
14212
14724
|
ctx.telemetry.emit("CommentThreadStarted", {
|
|
14213
14725
|
canvasId: input.canvasId,
|
|
@@ -14339,6 +14851,7 @@ const inviteContract = (invite, at) => ({
|
|
|
14339
14851
|
inviteId: invite.id,
|
|
14340
14852
|
email: invite.email,
|
|
14341
14853
|
role: invite.role,
|
|
14854
|
+
contentAccess: invite.contentAccess,
|
|
14342
14855
|
sendCount: invite.sendCount,
|
|
14343
14856
|
lastSentAt: invite.lastSentAt.toISOString(),
|
|
14344
14857
|
expiresAt: invite.expiresAt.toISOString(),
|
|
@@ -14408,12 +14921,17 @@ const add = (handlers) => personProcedure.input(addMemberInputSchema).output(add
|
|
|
14408
14921
|
organisationId: input.organisationId,
|
|
14409
14922
|
personId: ctx.viewer.personId,
|
|
14410
14923
|
email: input.email,
|
|
14411
|
-
role: input.role
|
|
14924
|
+
role: input.role,
|
|
14925
|
+
contentAccess: input.contentAccess
|
|
14412
14926
|
})));
|
|
14413
14927
|
const setRole = (handlers) => personProcedure.input(setMemberRoleInputSchema).output(setMemberRoleOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.setMemberRole.execute({
|
|
14414
14928
|
...input,
|
|
14415
14929
|
actorPersonId: ctx.viewer.personId
|
|
14416
14930
|
})));
|
|
14931
|
+
const setContentAccess = (handlers) => personProcedure.input(setMemberContentAccessInputSchema).output(setMemberContentAccessOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.setMemberContentAccess.execute({
|
|
14932
|
+
...input,
|
|
14933
|
+
actorPersonId: ctx.viewer.personId
|
|
14934
|
+
})));
|
|
14417
14935
|
const remove = (handlers) => personProcedure.input(removeMemberInputSchema).output(removeMemberOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.removeMember.execute({
|
|
14418
14936
|
...input,
|
|
14419
14937
|
actorPersonId: ctx.viewer.personId
|
|
@@ -14427,6 +14945,7 @@ const createOrganisationPeopleRouter = (handlers) => trpcRouter({
|
|
|
14427
14945
|
list: list(handlers),
|
|
14428
14946
|
add: add(handlers),
|
|
14429
14947
|
setRole: setRole(handlers),
|
|
14948
|
+
setContentAccess: setContentAccess(handlers),
|
|
14430
14949
|
remove: remove(handlers),
|
|
14431
14950
|
transferOwnership: transferOwnership(handlers)
|
|
14432
14951
|
});
|
|
@@ -14744,7 +15263,7 @@ const artifactCapabilitiesProcedure = (handlers) => personProcedure.input(getPro
|
|
|
14744
15263
|
},
|
|
14745
15264
|
attachmentProtocolVersion: 1
|
|
14746
15265
|
}));
|
|
14747
|
-
const createArtifactProcedure = (handlers) =>
|
|
15266
|
+
const createArtifactProcedure = (handlers) => canvasEditorProcedure.input(createPrototypeArtifactInputSchema).output(createPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
|
|
14748
15267
|
const created = orThrow(await handlers.artifactPublishing.create({
|
|
14749
15268
|
...input,
|
|
14750
15269
|
prototypeId: input.prototypeId ?? null,
|
|
@@ -14771,7 +15290,7 @@ const createArtifactProcedure = (handlers) => canvasCommenterProcedure.input(cre
|
|
|
14771
15290
|
}
|
|
14772
15291
|
};
|
|
14773
15292
|
});
|
|
14774
|
-
const submitArtifactProcedure = (handlers) =>
|
|
15293
|
+
const submitArtifactProcedure = (handlers) => canvasEditorProcedure.input(submitPrototypeArtifactInputSchema).output(submitPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
|
|
14775
15294
|
const deployment = orThrow(await handlers.artifactPublishing.submit({
|
|
14776
15295
|
...input,
|
|
14777
15296
|
personId: toPrototypePublisher(ctx.viewer).personId
|
|
@@ -14781,7 +15300,7 @@ const submitArtifactProcedure = (handlers) => canvasCommenterProcedure.input(sub
|
|
|
14781
15300
|
state: deployment.state
|
|
14782
15301
|
};
|
|
14783
15302
|
});
|
|
14784
|
-
const artifactStatusProcedure = (handlers) =>
|
|
15303
|
+
const artifactStatusProcedure = (handlers) => canvasEditorProcedure.input(getPrototypePublishStatusInputSchema).output(getPrototypePublishStatusOutputSchema).query(async ({ input, ctx }) => {
|
|
14785
15304
|
const status = orThrow(await handlers.artifactPublishing.status({
|
|
14786
15305
|
...input,
|
|
14787
15306
|
personId: toPrototypePublisher(ctx.viewer).personId
|
|
@@ -14811,7 +15330,7 @@ const artifactStatusProcedure = (handlers) => canvasCommenterProcedure.input(get
|
|
|
14811
15330
|
}
|
|
14812
15331
|
};
|
|
14813
15332
|
});
|
|
14814
|
-
const attachArtifactProcedure = (handlers) =>
|
|
15333
|
+
const attachArtifactProcedure = (handlers) => canvasEditorProcedure.input(attachPrototypeArtifactInputSchema).output(attachPrototypeArtifactOutputSchema).mutation(async ({ input, ctx }) => {
|
|
14815
15334
|
const publisher = toPrototypePublisher(ctx.viewer);
|
|
14816
15335
|
const completed = orThrow(await handlers.upload.complete({
|
|
14817
15336
|
...input,
|
|
@@ -15012,7 +15531,10 @@ const createRecordingRouter = (handlers) => trpcRouter({
|
|
|
15012
15531
|
truncated: false
|
|
15013
15532
|
};
|
|
15014
15533
|
}),
|
|
15015
|
-
delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input }) => orThrow(await handlers.remove.execute(
|
|
15534
|
+
delete: canvasOwnerProcedure.input(deleteRecordingInputSchema).output(deleteRecordingOutputSchema).mutation(async ({ input, ctx }) => orThrow(await handlers.remove.execute({
|
|
15535
|
+
...input,
|
|
15536
|
+
personId: ctx.viewer.personId
|
|
15537
|
+
})))
|
|
15016
15538
|
});
|
|
15017
15539
|
|
|
15018
15540
|
//#endregion
|
|
@@ -15094,7 +15616,7 @@ const recordingRepairRoutes = (handlers) => ({
|
|
|
15094
15616
|
//#endregion
|
|
15095
15617
|
//#region ../api/src/screen/infrastructure/screen.router.ts
|
|
15096
15618
|
/**
|
|
15097
|
-
* @justified
|
|
15619
|
+
* @justified intent
|
|
15098
15620
|
* Translates a transport call into a command. No rules, no persistence.
|
|
15099
15621
|
*
|
|
15100
15622
|
* There is no `get` and no `list`: a procedure taking a bare `screenId` would have to answer
|
|
@@ -15301,7 +15823,7 @@ const toCanvasAssetUploadContract = (asset) => ({
|
|
|
15301
15823
|
//#endregion
|
|
15302
15824
|
//#region ../api/src/canvas/infrastructure/canvas-asset.router.ts
|
|
15303
15825
|
const createCanvasAssetRouter = (handlers) => trpcRouter({
|
|
15304
|
-
reserve:
|
|
15826
|
+
reserve: canvasEditorProcedure.meta({ description: "Reserve an actor-owned, checksum-bound image or font import. Identical retries refresh upload access; changed content requires a new token." }).input(reserveCanvasAssetInputSchema).output(reserveCanvasAssetOutputSchema).mutation(async ({ input, ctx }) => {
|
|
15305
15827
|
const { asset, upload } = orThrow(await handlers.assets.reserve({
|
|
15306
15828
|
...input,
|
|
15307
15829
|
personId: ctx.viewer.personId
|
|
@@ -15314,7 +15836,7 @@ const createCanvasAssetRouter = (handlers) => trpcRouter({
|
|
|
15314
15836
|
}
|
|
15315
15837
|
};
|
|
15316
15838
|
}),
|
|
15317
|
-
complete:
|
|
15839
|
+
complete: canvasEditorProcedure.meta({ description: "Verify uploaded asset bytes and format, and persist resource readiness. Does not place content or change the canvas document." }).input(canvasAssetUploadIdentitySchema).output(canvasAssetUploadOutputSchema).mutation(async ({ input, ctx }) => toCanvasAssetUploadContract(orThrow(await handlers.assets.complete({
|
|
15318
15840
|
...input,
|
|
15319
15841
|
personId: ctx.viewer.personId
|
|
15320
15842
|
})))),
|
|
@@ -15408,6 +15930,12 @@ const unavailable = { execute: () => {
|
|
|
15408
15930
|
} };
|
|
15409
15931
|
const handlers = {
|
|
15410
15932
|
capture: {
|
|
15933
|
+
review: {
|
|
15934
|
+
read: unavailable.execute,
|
|
15935
|
+
decide: unavailable.execute,
|
|
15936
|
+
reference: unavailable.execute,
|
|
15937
|
+
promote: unavailable.execute
|
|
15938
|
+
},
|
|
15411
15939
|
begin: unavailable.execute,
|
|
15412
15940
|
get: unavailable.execute,
|
|
15413
15941
|
reserve: unavailable.execute,
|
|
@@ -15425,6 +15953,7 @@ const handlers = {
|
|
|
15425
15953
|
update: unavailable,
|
|
15426
15954
|
remove: unavailable,
|
|
15427
15955
|
setMemberRole: unavailable,
|
|
15956
|
+
setMemberContentAccess: unavailable,
|
|
15428
15957
|
removeMember: unavailable,
|
|
15429
15958
|
transferOwnership: unavailable,
|
|
15430
15959
|
createInvite: unavailable,
|
|
@@ -16167,4 +16696,4 @@ const withCommandInFailure = (value, commandName) => ({
|
|
|
16167
16696
|
});
|
|
16168
16697
|
|
|
16169
16698
|
//#endregion
|
|
16170
|
-
export { canvasRenderPendingSchema as $, canvasRenderTargetSchema as $n, createOrganisationOutputSchema as $t, operationStatusOutputSchema as A,
|
|
16699
|
+
export { canvasRenderPendingSchema as $, canvasRenderTargetSchema as $n, createOrganisationOutputSchema as $t, operationStatusOutputSchema as A, canvasAgentActivityPhaseSchema as An, PartialBatchError as At, canvasCaptureCapabilityInputSchema as B, applyCanvasOperationsOutputSchema as Bn, PROTOTYPE_ARTIFACT_MANIFEST_PATH as Bt, canvasSnapshotToken as C, canvasTextPropsWithContent as Cn, canvasEditsSchema as Ct, canvasConversionStatusSchema as D, canvasPrototypePropsSchema as Dn, fromCanvasReference as Dt, resolveCanvasSnapshot as E, canvasConversionMetadataSchema as En, canvasReferenceRenderTarget as Et, canvasArrangeInputSchema as F, DEFAULT_CANVAS_REFERENCE_PAGE_ID as Fn, createScreenOutputSchema as Ft, canvasRenderCapabilityInputSchema as G, getCanvasDocumentOutputSchema as Gn, getPrototypePublishStatusOutputSchema as Gt, canvasCaptureOutputSchema as H, canvasLayoutWithoutCssProperties as Hn, createPrototypeArtifactOutputSchema as Ht, canvasDuplicateCapabilityInputSchema as I, canvasReferencePageOf as In, appendRecordingChunkOutputSchema as It, prototypePublishCapabilityInputSchema as J, canvasNodeStylePatchSchema as Jn, submitPrototypeArtifactOutputSchema as Jt, canvasWriteHtmlCapabilityInputSchema as K, saveCanvasDocumentOutputSchema as Kn, prototypeArtifactManifestSchema as Kt, canvasDuplicateInputSchema as L, resolveCanvasReference as Ln, completeRecordingOutputSchema as Lt, canvasAssetImportInputSchema as M, agentClientMetadata as Mn, transcriptOutputSchema as Mt, canvasAssetImportOutputSchema as N, createCanvasPreparationOutputSchema as Nn, appErrorSchema as Nt, operationStatusImageSchema as O, canvasRecordingPropsSchema as On, hasCanvasReferenceScope as Ot, canvasArrangeCapabilityInputSchema as P, getCanvasPreparationOutputSchema as Pn, completeScreenOutputSchema as Pt, canvasRenderBatchResultSchema as Q, canvasRenderStateSchema as Qn, createAgentTokenOutputSchema as Qt, canvasPreparationOutputSchema as R, PAGE_KIND as Rn, getRecordingOutputSchema as Rt, canvasExchangeDigest as S, canvasTextChangeBetween as Sn, canvasEditCapabilityInputSchema as St, encodeCanvasExchangeToken as T, canvasCaptureSchema as Tn, canvasReferenceNodeIds as Tt, canvasApplyCapabilityInputSchema as U, textOf as Un, foldPrototypeArtifactPath as Ut, canvasCaptureInputSchema as V, getCanvasMutationOutputSchema as Vn, attachPrototypeArtifactOutputSchema as Vt, canvasReadCapabilityInputSchema as W, mapCanvasFontSources as Wn, getPrototypeArtifactCapabilitiesOutputSchema as Wt, transcriptReadCapabilityInputSchema as X, getCanvasConversionOutputSchema as Xn, MCP_AUTH_SCOPE as Xt, recordingSnapshotCapabilityInputSchema as Y, createCanvasConversionOutputSchema as Yn, getMeOutputSchema as Yt, canvasRenderBatchRequestSchema as Z, canvasRenderSourceStateSchema as Zn, cliAuthConfigurationSchema as Zt, PROCEDURE_DESCRIPTIONS as _, screenElementsCommentTargetSchema as _n, canvasImageAssetIdentityFromPath as _r, canvasFindOutputSchema as _t, toFailurePayload as a, commentMessageSchema as an, canvasReadableSceneDocumentSchema as ar, canvasRemoveInputSchema as at, canvasPrototypeIntentSchema as b, applyCanvasTypographyPatch as bn, createCanvasOutputSchema as br, canvasMakeEditableCapabilityInputSchema as bt, toPresentedCapabilities as c, domLocatorSchema as cn, canvasAuthoredStyleDeclarations as cr, canvasReadOutputSchema as ct, ProcessExitError as d, listCommentsInputSchema as dn, canvasLayoutPriorityDeclarations as dr, canvasTranscriptCursorSchema as dt, listOrganisationsOutputSchema as en, canvasWorldBoundsSchema as er, canvasRenderScopedInputSchema as et, createCapabilityCatalogAdapter as f, listCommentsOutputSchema as fn, canvasCssValue as fr, canvasResourcesCursorSchema as ft, OPTION_DESCRIPTIONS as g, screenElementCommentTargetSchema as gn, canvasFontAssetIdentityFromPath as gr, canvasFindInputSchema as gt, toCapabilityDefinition as h, screenAreaCommentTargetSchema as hn, reserveCanvasAssetOutputSchema as hr, canvasFindCursorSchema as ht, toExitCode as i, commentCanvasContextSchema as in, getCanvasRenderOutputSchema as ir, canvasRemoveCapabilityInputSchema as it, canvasAssetImportCapabilityInputSchema as j, AGENT_CLIENT_HEADER as jn, CliError as jt, operationStatusInputSchema as k, beginCanvasActivityOutputSchema as kn, parseCanvasReference as kt, toSharedCapabilities as l, elementAnchorSchema as ln, canvasAxisStyleProperties as lr, canvasUpdateHtmlCapabilityInputSchema as lt, createCapabilityPolicyAdapter as m, replyCommentOutputSchema as mn, reserveCanvasAssetInputSchema as mr, canvasCreateToolOutputSchema as mt, withCommandName as n, withFixtureScreen as nn, createRecordingSnapshotOutputSchema as nr, canvasRenderRequestSchema as nt, toMcpFailurePayload as o, commentResolverSchema as on, canvasSceneDocumentSchema as or, canvasOutlineCursorSchema as ot, createRouterShapeAdapter as p, replyCommentInputSchema as pn, canvasAssetUploadOutputSchema as pr, canvasCreateToolInputSchema as pt, commentAttentionCapabilityInputSchema as q, canvasOperationSchema as qn, prototypeArtifactPathSchema as qt, toCanvasAuthoringResult as r, commentAuthorSchema as rn, downloadCanvasRenderOutputSchema as rr, canvasRenderFileSchema as rt, toRemoteError as s, commentThreadSchema as sn, canvasAuthoredLayoutValueOf as sr, canvasReadInputSchema as st, withCommandInFailure as t, emptyFixtureDocument as tn, createCanvasRenderOutputSchema as tr, canvasRenderScopedToolInputSchema as tt, createMcpCapabilityDiscoveryAdapter as u, getCommentOutputSchema as un, canvasLayoutMainAxisOf as ur, canvasUpdateHtmlInputSchema as ut, canvasPrototypeCapabilityInputSchema as v, screenTextCommentTargetSchema as vn, canvasAdditionalStyleSchema as vr, canvasInsertHtmlCapabilityInputSchema as vt, decodeCanvasExchangeToken as w, canvasTextRunsOf as wn, assertCanvasReferenceNodes as wt, canvasPrototypeOutputSchema as x, canvasCssTypographyOwners as xn, listCanvasesOutputSchema as xr, canvasMakeEditableInputSchema as xt, canvasPrototypeInputSchema as y, startCommentInputSchema as yn, canvasSchema as yr, canvasInsertHtmlInputSchema as yt, canvasWriteReceiptSchema as z, applyCanvasOperationsInputSchema as zn, startRecordingOutputSchema as zt };
|