@replohq/sandbox-runtime 1.16.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_vendor/replo-utils/lib/historyKeys.d.ts +2 -0
- package/_vendor/replo-utils/lib/historyKeys.mjs +18 -0
- package/_vendor/replo-utils/lib/viewportSnapshot.d.ts +1 -1
- package/_vendor/replo-utils/lib/viewportSnapshot.mjs +1 -1
- package/_vendor/replo-utils/react/use-viewport-snapshot-responder.mjs +28 -5222
- package/_vendor/schemas/errors.d.ts +3 -43
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
- package/_vendor/schemas/iframeRpcChannel.mjs +2 -0
- package/_vendor/schemas/reploError.d.ts +43 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +146 -7
- package/_vendor/schemas/selectModeIframeRpc.mjs +73 -10
- package/buildMetadata.js +3 -3
- package/{chunk-3YA3QXUQ.mjs → chunk-B3PLD7SH.mjs} +29 -18
- package/package.json +4 -4
- package/rrweb-snapshot-GTQBXO2Y.mjs +5761 -0
- package/select-mode/EditorSelection.js +5 -1
- package/select-mode/fast-refresh-relay.js +82 -3
- package/select-mode/fiber.d.ts +6 -0
- package/select-mode/fiber.js +33 -0
- package/select-mode/hooks/useParentMessaging.js +10 -3
- package/select-mode/hooks/useSelectionHover.js +2 -1
- package/select-mode/hooks/useSelectionInteractions.js +10 -0
- package/select-mode/iframeRpcChannel.d.ts +45 -7
- package/select-mode/iframeRpcChannel.js +9 -8
- package/select-mode/section-canvas/SectionCanvas.d.ts +7 -0
- package/select-mode/section-canvas/SectionCanvas.js +599 -0
- package/select-mode/section-canvas/optimisticSectionMove.d.ts +39 -0
- package/select-mode/section-canvas/optimisticSectionMove.js +172 -0
- package/select-mode/section-canvas/sectionCanvasControls.d.ts +3 -0
- package/select-mode/section-canvas/sectionCanvasControls.js +8 -0
- package/select-mode/section-canvas/sectionCanvasStore.d.ts +71 -0
- package/select-mode/section-canvas/sectionCanvasStore.js +275 -0
- package/select-mode/section-canvas/sectionElements.d.ts +16 -0
- package/select-mode/section-canvas/sectionElements.js +94 -0
- package/select-mode/section-canvas/sectionGhost.d.ts +5 -0
- package/select-mode/section-canvas/sectionGhost.js +23 -0
- package/select-mode/symbolicate.d.ts +2 -0
- package/select-mode/symbolicate.js +18 -1
|
@@ -1,48 +1,8 @@
|
|
|
1
1
|
import type { ErrorUserFacingDetails, ErrorUserFacingDetailsWithMessage } from "./generated/errors";
|
|
2
|
+
import type { ReploErrorConfig } from "./reploError";
|
|
2
3
|
import * as z from "zod";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export type ReploErrorConfig = {
|
|
7
|
-
/**
|
|
8
|
-
* Message of the error, used only internally. If not provided, defaults to
|
|
9
|
-
* the error's class name
|
|
10
|
-
*/
|
|
11
|
-
message?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Any additional data about the error, e.g. ids of content that was trying
|
|
14
|
-
* to be accessed, contextual variables, etc. This is included when the error
|
|
15
|
-
* is logged to Sentry, etc
|
|
16
|
-
*/
|
|
17
|
-
additionalData?: Record<string, unknown>;
|
|
18
|
-
/** Meta details for error reporting */
|
|
19
|
-
errorReportingDetails?: {
|
|
20
|
-
/**
|
|
21
|
-
* If true, tells Sentry that it should group this error differently when
|
|
22
|
-
* it happens on different endpoints ("transactions" in Sentry are endpoints)
|
|
23
|
-
*/
|
|
24
|
-
includeTransactionInFingerprint?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* If provided, these get added to the Sentry fingerprint for this error. Useful
|
|
27
|
-
* for when you want to modify the grouping of an error, especially for reusing
|
|
28
|
-
* errors in different places.
|
|
29
|
-
*/
|
|
30
|
-
customFingerprint?: string[];
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Original cause of the error (useful for if you need to catch and re-throw errors
|
|
34
|
-
* with more context). Will be reported in stacktraces, sentry, etc.
|
|
35
|
-
*/
|
|
36
|
-
cause?: unknown;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Base error that all errors in Replo inherit from
|
|
40
|
-
*/
|
|
41
|
-
export declare abstract class ReploError extends Error {
|
|
42
|
-
config: ReploErrorConfig;
|
|
43
|
-
id: string;
|
|
44
|
-
constructor(config: ReploErrorConfig);
|
|
45
|
-
}
|
|
4
|
+
import { ReploError } from "./reploError";
|
|
5
|
+
export { ReploError, type ReploErrorConfig } from "./reploError";
|
|
46
6
|
/**
|
|
47
7
|
* Wraps an error so `async-retry` stops immediately instead of scheduling
|
|
48
8
|
* another attempt: the library rejects with any thrown error carrying a truthy
|
|
@@ -9,6 +9,49 @@ export type IframeRuntimeBuildMetadata = {
|
|
|
9
9
|
branch: string | null;
|
|
10
10
|
commit: string | null;
|
|
11
11
|
builtAt: string | null;
|
|
12
|
+
capabilities?: string[];
|
|
13
|
+
};
|
|
14
|
+
export type SectionCanvasSection = {
|
|
15
|
+
index: number;
|
|
16
|
+
startLine: number;
|
|
17
|
+
endLine: number;
|
|
18
|
+
label: string;
|
|
19
|
+
isLocked: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type SectionCanvasState = {
|
|
22
|
+
pageFilePath: string;
|
|
23
|
+
sections: SectionCanvasSection[];
|
|
24
|
+
previewScale: number;
|
|
25
|
+
isDisabled: boolean;
|
|
26
|
+
insertingAt?: number | null;
|
|
27
|
+
occludedInsets?: {
|
|
28
|
+
left: number;
|
|
29
|
+
right: number;
|
|
30
|
+
} | null;
|
|
31
|
+
};
|
|
32
|
+
export type SectionCanvasRequest = {
|
|
33
|
+
type: "insert";
|
|
34
|
+
at: number;
|
|
35
|
+
} | {
|
|
36
|
+
type: "move";
|
|
37
|
+
moveId: string;
|
|
38
|
+
index: number;
|
|
39
|
+
to: number;
|
|
40
|
+
} | {
|
|
41
|
+
type: "remove";
|
|
42
|
+
index: number;
|
|
43
|
+
} | {
|
|
44
|
+
type: "undo";
|
|
45
|
+
} | {
|
|
46
|
+
type: "redo";
|
|
47
|
+
} | {
|
|
48
|
+
type: "cancelInsert";
|
|
49
|
+
};
|
|
50
|
+
export type SectionCanvasLayoutEntry = {
|
|
51
|
+
index: number;
|
|
52
|
+
startLine: number;
|
|
53
|
+
endLine: number;
|
|
54
|
+
rect: SelectModeBoundingRect;
|
|
12
55
|
};
|
|
13
56
|
export type SelectModeParentMessage = {
|
|
14
57
|
method: "expandToSection";
|
|
@@ -10,6 +10,7 @@ var defaultLogger = {
|
|
|
10
10
|
debug: console.debug,
|
|
11
11
|
error: console.error
|
|
12
12
|
};
|
|
13
|
+
|
|
13
14
|
var ReploError = class _ReploError extends Error {
|
|
14
15
|
config;
|
|
15
16
|
id;
|
|
@@ -30,6 +31,7 @@ var ReploError = class _ReploError extends Error {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
};
|
|
34
|
+
|
|
33
35
|
var errorUserFacingDetailsMessageSchema = z.object({
|
|
34
36
|
type: z.enum([
|
|
35
37
|
"toast",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config to use for any standard error we throw in Replo
|
|
3
|
+
*/
|
|
4
|
+
export type ReploErrorConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* Message of the error, used only internally. If not provided, defaults to
|
|
7
|
+
* the error's class name
|
|
8
|
+
*/
|
|
9
|
+
message?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Any additional data about the error, e.g. ids of content that was trying
|
|
12
|
+
* to be accessed, contextual variables, etc. This is included when the error
|
|
13
|
+
* is logged to Sentry, etc
|
|
14
|
+
*/
|
|
15
|
+
additionalData?: Record<string, unknown>;
|
|
16
|
+
/** Meta details for error reporting */
|
|
17
|
+
errorReportingDetails?: {
|
|
18
|
+
/**
|
|
19
|
+
* If true, tells Sentry that it should group this error differently when
|
|
20
|
+
* it happens on different endpoints ("transactions" in Sentry are endpoints)
|
|
21
|
+
*/
|
|
22
|
+
includeTransactionInFingerprint?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If provided, these get added to the Sentry fingerprint for this error. Useful
|
|
25
|
+
* for when you want to modify the grouping of an error, especially for reusing
|
|
26
|
+
* errors in different places.
|
|
27
|
+
*/
|
|
28
|
+
customFingerprint?: string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Original cause of the error (useful for if you need to catch and re-throw errors
|
|
32
|
+
* with more context). Will be reported in stacktraces, sentry, etc.
|
|
33
|
+
*/
|
|
34
|
+
cause?: unknown;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Base error that all errors in Replo inherit from
|
|
38
|
+
*/
|
|
39
|
+
export declare abstract class ReploError extends Error {
|
|
40
|
+
config: ReploErrorConfig;
|
|
41
|
+
id: string;
|
|
42
|
+
constructor(config: ReploErrorConfig);
|
|
43
|
+
}
|
|
@@ -25,6 +25,75 @@ export declare const iframeRuntimeBuildMetadataSchema: z.ZodObject<{
|
|
|
25
25
|
branch: z.ZodNullable<z.ZodString>;
|
|
26
26
|
commit: z.ZodNullable<z.ZodString>;
|
|
27
27
|
builtAt: z.ZodNullable<z.ZodString>;
|
|
28
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
/** Runtimes listing this draw section insert and drag controls on the canvas and accept `setSectionCanvas`. */
|
|
31
|
+
export declare const SECTION_CANVAS_CAPABILITY = "sectionCanvas";
|
|
32
|
+
export declare const sectionCanvasSectionSchema: z.ZodObject<{
|
|
33
|
+
index: z.ZodNumber;
|
|
34
|
+
startLine: z.ZodNumber;
|
|
35
|
+
endLine: z.ZodNumber;
|
|
36
|
+
label: z.ZodString;
|
|
37
|
+
isLocked: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a source location's file is the canvas's page file. Locations arrive as `file://` URLs,
|
|
41
|
+
* `./`-relative or absolute paths, and the page file is workspace-relative, so either may be a path
|
|
42
|
+
* suffix of the other. The builder's selection sync and the runtime's section finding both use this.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isSectionCanvasPageFile({ filePath, pageFilePath, }: {
|
|
45
|
+
filePath: string;
|
|
46
|
+
pageFilePath: string;
|
|
47
|
+
}): boolean;
|
|
48
|
+
export declare const sectionCanvasStateSchema: z.ZodObject<{
|
|
49
|
+
pageFilePath: z.ZodString;
|
|
50
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
51
|
+
index: z.ZodNumber;
|
|
52
|
+
startLine: z.ZodNumber;
|
|
53
|
+
endLine: z.ZodNumber;
|
|
54
|
+
label: z.ZodString;
|
|
55
|
+
isLocked: z.ZodBoolean;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
previewScale: z.ZodNumber;
|
|
58
|
+
isDisabled: z.ZodBoolean;
|
|
59
|
+
insertingAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
occludedInsets: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
61
|
+
left: z.ZodNumber;
|
|
62
|
+
right: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const sectionCanvasRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"insert">;
|
|
67
|
+
at: z.ZodNumber;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"move">;
|
|
70
|
+
moveId: z.ZodString;
|
|
71
|
+
index: z.ZodNumber;
|
|
72
|
+
to: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"remove">;
|
|
75
|
+
index: z.ZodNumber;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"undo">;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"redo">;
|
|
80
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
81
|
+
type: z.ZodLiteral<"cancelInsert">;
|
|
82
|
+
}, z.core.$strip>], "type">;
|
|
83
|
+
export declare const sectionCanvasLayoutEntrySchema: z.ZodObject<{
|
|
84
|
+
index: z.ZodNumber;
|
|
85
|
+
startLine: z.ZodNumber;
|
|
86
|
+
endLine: z.ZodNumber;
|
|
87
|
+
rect: z.ZodObject<{
|
|
88
|
+
x: z.ZodNumber;
|
|
89
|
+
y: z.ZodNumber;
|
|
90
|
+
left: z.ZodNumber;
|
|
91
|
+
top: z.ZodNumber;
|
|
92
|
+
right: z.ZodNumber;
|
|
93
|
+
bottom: z.ZodNumber;
|
|
94
|
+
width: z.ZodNumber;
|
|
95
|
+
height: z.ZodNumber;
|
|
96
|
+
}, z.core.$strip>;
|
|
28
97
|
}, z.core.$strip>;
|
|
29
98
|
export declare const selectModeEventInputSchemas: {
|
|
30
99
|
hover: z.ZodObject<{
|
|
@@ -185,6 +254,38 @@ export declare const selectModeEventInputSchemas: {
|
|
|
185
254
|
}, z.core.$strip>;
|
|
186
255
|
};
|
|
187
256
|
export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
257
|
+
setSectionCanvas: {
|
|
258
|
+
inputSchema: z.ZodObject<{
|
|
259
|
+
canvas: z.ZodNullable<z.ZodObject<{
|
|
260
|
+
pageFilePath: z.ZodString;
|
|
261
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
262
|
+
index: z.ZodNumber;
|
|
263
|
+
startLine: z.ZodNumber;
|
|
264
|
+
endLine: z.ZodNumber;
|
|
265
|
+
label: z.ZodString;
|
|
266
|
+
isLocked: z.ZodBoolean;
|
|
267
|
+
}, z.core.$strip>>;
|
|
268
|
+
previewScale: z.ZodNumber;
|
|
269
|
+
isDisabled: z.ZodBoolean;
|
|
270
|
+
insertingAt: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
271
|
+
occludedInsets: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
272
|
+
left: z.ZodNumber;
|
|
273
|
+
right: z.ZodNumber;
|
|
274
|
+
}, z.core.$strip>>>;
|
|
275
|
+
}, z.core.$strip>>;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
outputSchema: z.ZodVoid;
|
|
278
|
+
};
|
|
279
|
+
settleSectionMove: {
|
|
280
|
+
inputSchema: z.ZodObject<{
|
|
281
|
+
moveId: z.ZodString;
|
|
282
|
+
outcome: z.ZodEnum<{
|
|
283
|
+
failed: "failed";
|
|
284
|
+
persisted: "persisted";
|
|
285
|
+
}>;
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
outputSchema: z.ZodVoid;
|
|
288
|
+
};
|
|
188
289
|
expandToSection: {
|
|
189
290
|
inputSchema: z.ZodObject<{
|
|
190
291
|
targetSelector: z.ZodString;
|
|
@@ -367,7 +468,6 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
|
367
468
|
navigateToRoute: {
|
|
368
469
|
inputSchema: z.ZodObject<{
|
|
369
470
|
pathname: z.ZodString;
|
|
370
|
-
navigationId: z.ZodOptional<z.ZodNumber>;
|
|
371
471
|
}, z.core.$strip>;
|
|
372
472
|
outputSchema: z.ZodVoid;
|
|
373
473
|
};
|
|
@@ -479,6 +579,49 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
|
479
579
|
};
|
|
480
580
|
};
|
|
481
581
|
export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
582
|
+
sectionCanvasRequest: {
|
|
583
|
+
inputSchema: z.ZodObject<{
|
|
584
|
+
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
585
|
+
type: z.ZodLiteral<"insert">;
|
|
586
|
+
at: z.ZodNumber;
|
|
587
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
588
|
+
type: z.ZodLiteral<"move">;
|
|
589
|
+
moveId: z.ZodString;
|
|
590
|
+
index: z.ZodNumber;
|
|
591
|
+
to: z.ZodNumber;
|
|
592
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
593
|
+
type: z.ZodLiteral<"remove">;
|
|
594
|
+
index: z.ZodNumber;
|
|
595
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
596
|
+
type: z.ZodLiteral<"undo">;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
type: z.ZodLiteral<"redo">;
|
|
599
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
600
|
+
type: z.ZodLiteral<"cancelInsert">;
|
|
601
|
+
}, z.core.$strip>], "type">;
|
|
602
|
+
}, z.core.$strip>;
|
|
603
|
+
outputSchema: z.ZodVoid;
|
|
604
|
+
};
|
|
605
|
+
sectionCanvasLayoutChanged: {
|
|
606
|
+
inputSchema: z.ZodObject<{
|
|
607
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
608
|
+
index: z.ZodNumber;
|
|
609
|
+
startLine: z.ZodNumber;
|
|
610
|
+
endLine: z.ZodNumber;
|
|
611
|
+
rect: z.ZodObject<{
|
|
612
|
+
x: z.ZodNumber;
|
|
613
|
+
y: z.ZodNumber;
|
|
614
|
+
left: z.ZodNumber;
|
|
615
|
+
top: z.ZodNumber;
|
|
616
|
+
right: z.ZodNumber;
|
|
617
|
+
bottom: z.ZodNumber;
|
|
618
|
+
width: z.ZodNumber;
|
|
619
|
+
height: z.ZodNumber;
|
|
620
|
+
}, z.core.$strip>;
|
|
621
|
+
}, z.core.$strip>>;
|
|
622
|
+
}, z.core.$strip>;
|
|
623
|
+
outputSchema: z.ZodVoid;
|
|
624
|
+
};
|
|
482
625
|
requestInlineTextEdit: {
|
|
483
626
|
inputSchema: z.ZodObject<{
|
|
484
627
|
editId: z.ZodString;
|
|
@@ -577,6 +720,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
577
720
|
branch: z.ZodNullable<z.ZodString>;
|
|
578
721
|
commit: z.ZodNullable<z.ZodString>;
|
|
579
722
|
builtAt: z.ZodNullable<z.ZodString>;
|
|
723
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
580
724
|
}, z.core.$strip>;
|
|
581
725
|
outputSchema: z.ZodVoid;
|
|
582
726
|
};
|
|
@@ -918,12 +1062,6 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
918
1062
|
inputSchema: z.ZodUndefined;
|
|
919
1063
|
outputSchema: z.ZodVoid;
|
|
920
1064
|
};
|
|
921
|
-
navigationAccepted: {
|
|
922
|
-
inputSchema: z.ZodObject<{
|
|
923
|
-
navigationId: z.ZodNumber;
|
|
924
|
-
}, z.core.$strip>;
|
|
925
|
-
outputSchema: z.ZodVoid;
|
|
926
|
-
};
|
|
927
1065
|
};
|
|
928
1066
|
export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
929
1067
|
method: z.ZodLiteral<"expandToSection">;
|
|
@@ -1039,6 +1177,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
1039
1177
|
branch: z.ZodNullable<z.ZodString>;
|
|
1040
1178
|
commit: z.ZodNullable<z.ZodString>;
|
|
1041
1179
|
builtAt: z.ZodNullable<z.ZodString>;
|
|
1180
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1042
1181
|
}, z.core.$strip>;
|
|
1043
1182
|
}, z.core.$strip>, z.ZodObject<{
|
|
1044
1183
|
method: z.ZodLiteral<"elementSelected">;
|
|
@@ -16,8 +16,57 @@ var iframeRuntimeBuildMetadataSchema = z.object({
|
|
|
16
16
|
version: z.string(),
|
|
17
17
|
branch: z.string().nullable(),
|
|
18
18
|
commit: z.string().nullable(),
|
|
19
|
-
builtAt: z.string().nullable()
|
|
19
|
+
builtAt: z.string().nullable(),
|
|
20
|
+
capabilities: z.array(z.string()).optional()
|
|
20
21
|
}).describe("IframeRuntimeBuildMetadata");
|
|
22
|
+
var SECTION_CANVAS_CAPABILITY = "sectionCanvas";
|
|
23
|
+
var sectionCanvasSectionSchema = z.object({
|
|
24
|
+
index: z.number().int().nonnegative(),
|
|
25
|
+
startLine: z.number().int().positive(),
|
|
26
|
+
endLine: z.number().int().positive(),
|
|
27
|
+
label: z.string(),
|
|
28
|
+
isLocked: z.boolean()
|
|
29
|
+
}).describe("SectionCanvasSection");
|
|
30
|
+
function isSectionCanvasPageFile({
|
|
31
|
+
filePath,
|
|
32
|
+
pageFilePath
|
|
33
|
+
}) {
|
|
34
|
+
const normalized = filePath.replace(/^file:\/\//u, "").replace(/^\.\//u, "");
|
|
35
|
+
return normalized === pageFilePath || normalized.endsWith(`/${pageFilePath}`) || pageFilePath.endsWith(`/${normalized}`);
|
|
36
|
+
}
|
|
37
|
+
var sectionCanvasStateSchema = z.object({
|
|
38
|
+
pageFilePath: z.string(),
|
|
39
|
+
sections: z.array(sectionCanvasSectionSchema),
|
|
40
|
+
previewScale: z.number().positive(),
|
|
41
|
+
isDisabled: z.boolean(),
|
|
42
|
+
insertingAt: z.number().int().nonnegative().nullish(),
|
|
43
|
+
occludedInsets: z.object({
|
|
44
|
+
left: z.number().nonnegative(),
|
|
45
|
+
right: z.number().nonnegative()
|
|
46
|
+
}).nullish()
|
|
47
|
+
}).describe("SectionCanvasState");
|
|
48
|
+
var sectionCanvasRequestSchema = z.discriminatedUnion("type", [
|
|
49
|
+
z.object({ type: z.literal("insert"), at: z.number().int().nonnegative() }),
|
|
50
|
+
z.object({
|
|
51
|
+
type: z.literal("move"),
|
|
52
|
+
moveId: z.string(),
|
|
53
|
+
index: z.number().int().nonnegative(),
|
|
54
|
+
to: z.number().int().nonnegative()
|
|
55
|
+
}),
|
|
56
|
+
z.object({
|
|
57
|
+
type: z.literal("remove"),
|
|
58
|
+
index: z.number().int().nonnegative()
|
|
59
|
+
}),
|
|
60
|
+
z.object({ type: z.literal("undo") }),
|
|
61
|
+
z.object({ type: z.literal("redo") }),
|
|
62
|
+
z.object({ type: z.literal("cancelInsert") })
|
|
63
|
+
]).describe("SectionCanvasRequest");
|
|
64
|
+
var sectionCanvasLayoutEntrySchema = z.object({
|
|
65
|
+
index: z.number().int().nonnegative(),
|
|
66
|
+
startLine: z.number().int().positive(),
|
|
67
|
+
endLine: z.number().int().positive(),
|
|
68
|
+
rect: selectModeBoundingRectSchema
|
|
69
|
+
}).describe("SectionCanvasLayoutEntry");
|
|
21
70
|
var selectModeEventInputSchemas = {
|
|
22
71
|
hover: z.object({
|
|
23
72
|
rect: selectModeHoverRectSchema.nullable()
|
|
@@ -37,6 +86,17 @@ var selectModeEventInputSchemas = {
|
|
|
37
86
|
})
|
|
38
87
|
};
|
|
39
88
|
var websiteBuilderToPreviewIframeMethodConfig = {
|
|
89
|
+
setSectionCanvas: {
|
|
90
|
+
inputSchema: z.object({ canvas: sectionCanvasStateSchema.nullable() }),
|
|
91
|
+
outputSchema: z.void()
|
|
92
|
+
},
|
|
93
|
+
settleSectionMove: {
|
|
94
|
+
inputSchema: z.object({
|
|
95
|
+
moveId: z.string(),
|
|
96
|
+
outcome: z.enum(["persisted", "failed"])
|
|
97
|
+
}),
|
|
98
|
+
outputSchema: z.void()
|
|
99
|
+
},
|
|
40
100
|
expandToSection: {
|
|
41
101
|
inputSchema: z.object({ targetSelector: z.string() }),
|
|
42
102
|
outputSchema: z.void()
|
|
@@ -51,10 +111,7 @@ var websiteBuilderToPreviewIframeMethodConfig = {
|
|
|
51
111
|
timeoutMs: 1500
|
|
52
112
|
},
|
|
53
113
|
navigateToRoute: {
|
|
54
|
-
inputSchema: z.object({
|
|
55
|
-
pathname: z.string(),
|
|
56
|
-
navigationId: z.number().int().optional()
|
|
57
|
-
}),
|
|
114
|
+
inputSchema: z.object({ pathname: z.string() }),
|
|
58
115
|
outputSchema: z.void()
|
|
59
116
|
},
|
|
60
117
|
setDisplayMode: {
|
|
@@ -113,6 +170,16 @@ var websiteBuilderToPreviewIframeMethodConfig = {
|
|
|
113
170
|
}
|
|
114
171
|
};
|
|
115
172
|
var previewIframeToWebsiteBuilderMethodConfig = {
|
|
173
|
+
sectionCanvasRequest: {
|
|
174
|
+
inputSchema: z.object({ request: sectionCanvasRequestSchema }),
|
|
175
|
+
outputSchema: z.void()
|
|
176
|
+
},
|
|
177
|
+
sectionCanvasLayoutChanged: {
|
|
178
|
+
inputSchema: z.object({
|
|
179
|
+
sections: z.array(sectionCanvasLayoutEntrySchema)
|
|
180
|
+
}),
|
|
181
|
+
outputSchema: z.void()
|
|
182
|
+
},
|
|
116
183
|
requestInlineTextEdit: {
|
|
117
184
|
inputSchema: z.object({
|
|
118
185
|
editId: z.string(),
|
|
@@ -176,10 +243,6 @@ var previewIframeToWebsiteBuilderMethodConfig = {
|
|
|
176
243
|
fastRefreshComplete: {
|
|
177
244
|
inputSchema: z.undefined(),
|
|
178
245
|
outputSchema: z.void()
|
|
179
|
-
},
|
|
180
|
-
navigationAccepted: {
|
|
181
|
-
inputSchema: z.object({ navigationId: z.number().int() }),
|
|
182
|
-
outputSchema: z.void()
|
|
183
246
|
}
|
|
184
247
|
};
|
|
185
248
|
var selectModeParentMessageSchema = z.discriminatedUnion("method", [
|
|
@@ -272,4 +335,4 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
|
|
|
272
335
|
})
|
|
273
336
|
]).describe("SelectModeIframeMessage");
|
|
274
337
|
|
|
275
|
-
export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, previewIframeToWebsiteBuilderMethodConfig, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
|
|
338
|
+
export { SECTION_CANVAS_CAPABILITY, SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, isSectionCanvasPageFile, previewIframeToWebsiteBuilderMethodConfig, sectionCanvasLayoutEntrySchema, sectionCanvasRequestSchema, sectionCanvasSectionSchema, sectionCanvasStateSchema, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
|
package/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-10-
|
|
5
|
+
"commit": "7d16c9a29182a37625a958569422b94a08b9a627",
|
|
6
|
+
"builtAt": "2026-10-20T04:21:24.844Z"
|
|
7
7
|
};
|
|
@@ -109,6 +109,29 @@ function startViewportSnapshotResponder({
|
|
|
109
109
|
};
|
|
110
110
|
requester.postMessage(response, requesterOrigin);
|
|
111
111
|
};
|
|
112
|
+
const requestType = event.data.type;
|
|
113
|
+
const respondWithChildFrames = (snapshot2, context2) => {
|
|
114
|
+
if (captureDom ? snapshot2 === null : !context2) {
|
|
115
|
+
respond(null);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
void requestChildViewportSnapshots({
|
|
119
|
+
targetWindow,
|
|
120
|
+
requestId: `${requestId}:${frameIndex}`,
|
|
121
|
+
timeoutMs: cascadeTimeoutMs,
|
|
122
|
+
remainingDepth: remainingDepth - 1,
|
|
123
|
+
requestType
|
|
124
|
+
}).then((childCaptures) => {
|
|
125
|
+
respond({
|
|
126
|
+
snapshot: snapshot2,
|
|
127
|
+
...context2 ? { context: context2 } : {},
|
|
128
|
+
childFrames: childCaptures.flatMap((child) => {
|
|
129
|
+
const rect = measureFrameRect(child.frameIndex);
|
|
130
|
+
return rect ? [{ frameIndex: child.frameIndex, rect, capture: child.capture }] : [];
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
112
135
|
let snapshot = null;
|
|
113
136
|
let context;
|
|
114
137
|
try {
|
|
@@ -119,26 +142,14 @@ function startViewportSnapshotResponder({
|
|
|
119
142
|
}
|
|
120
143
|
} catch {
|
|
121
144
|
}
|
|
122
|
-
if (
|
|
123
|
-
|
|
145
|
+
if (snapshot instanceof Promise) {
|
|
146
|
+
snapshot.then(
|
|
147
|
+
(resolved) => respondWithChildFrames(resolved, context),
|
|
148
|
+
() => respond(null)
|
|
149
|
+
);
|
|
124
150
|
return;
|
|
125
151
|
}
|
|
126
|
-
|
|
127
|
-
targetWindow,
|
|
128
|
-
requestId: `${requestId}:${frameIndex}`,
|
|
129
|
-
timeoutMs: cascadeTimeoutMs,
|
|
130
|
-
remainingDepth: remainingDepth - 1,
|
|
131
|
-
requestType: event.data.type
|
|
132
|
-
}).then((childCaptures) => {
|
|
133
|
-
respond({
|
|
134
|
-
snapshot,
|
|
135
|
-
...context ? { context } : {},
|
|
136
|
-
childFrames: childCaptures.flatMap((child) => {
|
|
137
|
-
const rect = measureFrameRect(child.frameIndex);
|
|
138
|
-
return rect ? [{ frameIndex: child.frameIndex, rect, capture: child.capture }] : [];
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
});
|
|
152
|
+
respondWithChildFrames(snapshot, context);
|
|
142
153
|
};
|
|
143
154
|
targetWindow.addEventListener("message", onMessage);
|
|
144
155
|
return () => {
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sandbox-runtime",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.17.0",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-10-
|
|
8
|
+
"commit": "7d16c9a29182a37625a958569422b94a08b9a627",
|
|
9
|
+
"builtAt": "2026-10-20T04:21:24.844Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|