@replohq/sandbox-runtime 1.8.0 → 1.10.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.
Files changed (47) hide show
  1. package/PageCaptureResponder.d.ts +1 -0
  2. package/PageCaptureResponder.js +12 -0
  3. package/_vendor/replo-utils/lib/crypto.mjs +1 -0
  4. package/_vendor/replo-utils/lib/fonts.mjs +18 -6
  5. package/_vendor/replo-utils/lib/math.mjs +1 -1
  6. package/_vendor/replo-utils/lib/pageCapture.d.ts +34 -0
  7. package/_vendor/replo-utils/lib/pageCapture.mjs +52 -0
  8. package/_vendor/schemas/generated/selectMode.d.ts +14 -0
  9. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +12 -2
  10. package/_vendor/schemas/iframeRpcChannel.mjs +1 -1
  11. package/_vendor/schemas/selectMode.d.ts +26 -2
  12. package/_vendor/schemas/selectMode.mjs +1 -1
  13. package/_vendor/schemas/selectModeIframeRpc.d.ts +53 -4
  14. package/_vendor/schemas/selectModeIframeRpc.mjs +18 -2
  15. package/_vendor/schemas/selectModeImage.mjs +6 -2
  16. package/buildMetadata.js +3 -3
  17. package/capturePage.d.ts +11 -0
  18. package/capturePage.js +261 -0
  19. package/chunk-LIPH4O4F.mjs +67 -0
  20. package/{chunk-XWNBKE63.mjs → chunk-PJBGUXBG.mjs} +6 -1
  21. package/design-library-preview/DesignLibraryPreview.js +18 -6
  22. package/package.json +5 -4
  23. package/sandbox-runtime.js +2 -0
  24. package/select-mode/EditorSelection.js +21 -4
  25. package/select-mode/SelectionFrames.js +56 -23
  26. package/select-mode/descriptor/elementDescriptor.d.ts +2 -1
  27. package/select-mode/descriptor/elementDescriptor.js +22 -14
  28. package/select-mode/hooks/useOptimisticOverrides.js +18 -6
  29. package/select-mode/hooks/useParentMessaging.d.ts +7 -1
  30. package/select-mode/hooks/useParentMessaging.js +6 -0
  31. package/select-mode/hooks/useSelectionHover.js +38 -15
  32. package/select-mode/hooks/useSelectionInteractions.js +9 -37
  33. package/select-mode/hooks/useSelectionScrollSync.js +5 -1
  34. package/select-mode/iframeRpcChannel.d.ts +10 -0
  35. package/select-mode/iframeRpcChannel.js +2 -0
  36. package/select-mode/imageOverridePreview.js +14 -5
  37. package/select-mode/imageSources.js +2 -1
  38. package/select-mode/inlineEditFeedback.js +9 -3
  39. package/select-mode/interactions/sectionGeometry.d.ts +3 -0
  40. package/select-mode/interactions/sectionGeometry.js +200 -0
  41. package/select-mode/selectModeStore.d.ts +36 -8
  42. package/select-mode/selectModeStore.js +141 -21
  43. package/select-mode/selectionFrame.d.ts +3 -1
  44. package/select-mode/selectionFrame.js +4 -0
  45. package/startPageCaptureResponder.d.ts +32 -0
  46. package/startPageCaptureResponder.js +87 -0
  47. package/chunk-SGKQ5HGT.mjs +0 -7
@@ -0,0 +1 @@
1
+ export declare function PageCaptureResponder(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { startPageCaptureResponder } from "./startPageCaptureResponder";
4
+ function startResponder() {
5
+ return startPageCaptureResponder(window);
6
+ }
7
+ function PageCaptureResponder() {
8
+ return /* @__PURE__ */ jsx("template", { ref: startResponder });
9
+ }
10
+ export {
11
+ PageCaptureResponder
12
+ };
@@ -0,0 +1 @@
1
+ export { base64UrlToBytes, bytesToBase64Url, constantTimeEqual, getHmacSha256Hex, randomBase64Url, randomUUID, sha256Hex } from '../../../chunk-LIPH4O4F.mjs';
@@ -184,16 +184,28 @@ function describeFontFile(fileName) {
184
184
  }
185
185
  function fontFormatFromExtension(extension) {
186
186
  const normalized = extension.toLowerCase().replace(/^\./u, "");
187
- if (normalized === "woff2") return "woff2";
188
- if (normalized === "woff") return "woff";
189
- if (normalized === "otf") return "opentype";
190
- if (normalized === "ttf") return "truetype";
187
+ if (normalized === "woff2") {
188
+ return "woff2";
189
+ }
190
+ if (normalized === "woff") {
191
+ return "woff";
192
+ }
193
+ if (normalized === "otf") {
194
+ return "opentype";
195
+ }
196
+ if (normalized === "ttf") {
197
+ return "truetype";
198
+ }
191
199
  return "woff2";
192
200
  }
193
201
  function fontFormatFromMimeType(mimeType) {
194
202
  const normalized = mimeType.toLowerCase();
195
- if (normalized.includes("woff2")) return "woff2";
196
- if (normalized.includes("woff")) return "woff";
203
+ if (normalized.includes("woff2")) {
204
+ return "woff2";
205
+ }
206
+ if (normalized.includes("woff")) {
207
+ return "woff";
208
+ }
197
209
  if (normalized.includes("otf") || normalized.includes("opentype")) {
198
210
  return "opentype";
199
211
  }
@@ -1,4 +1,4 @@
1
- import { randomUUID } from '../../../chunk-SGKQ5HGT.mjs';
1
+ import { randomUUID } from '../../../chunk-LIPH4O4F.mjs';
2
2
  import { isNumber_default } from '../../../chunk-FLYEIRFK.mjs';
3
3
  import '../../../chunk-G3S6ZNPF.mjs';
4
4
 
@@ -0,0 +1,34 @@
1
+ /** Site Builder asks the cross-origin preview iframe to draw its own first screen; the site's runtime replies with a JPEG. */
2
+ export declare const PAGE_CAPTURE_REQUEST = "replo:page-capture:request";
3
+ export declare const PAGE_CAPTURE_RESPONSE = "replo:page-capture:response";
4
+ export interface PageCaptureRequestMessage {
5
+ type: typeof PAGE_CAPTURE_REQUEST;
6
+ requestId: string;
7
+ width: number;
8
+ height: number;
9
+ }
10
+ export type PageCaptureResponseMessage = {
11
+ type: typeof PAGE_CAPTURE_RESPONSE;
12
+ requestId: string;
13
+ jpeg: ArrayBuffer;
14
+ ms: number;
15
+ } | {
16
+ type: typeof PAGE_CAPTURE_RESPONSE;
17
+ requestId: string;
18
+ jpeg: null;
19
+ error: string;
20
+ };
21
+ export declare function isPageCaptureRequestMessage(value: unknown): value is PageCaptureRequestMessage;
22
+ export declare class PageCaptureError extends Error {
23
+ }
24
+ /** Parent side: ask `frame` to capture itself and resolve with its JPEG bytes. */
25
+ export declare function requestPageCapture({ frame, targetOrigin, width, height, timeoutMs, }: {
26
+ frame: Window;
27
+ targetOrigin: string;
28
+ width: number;
29
+ height: number;
30
+ timeoutMs?: number;
31
+ }): Promise<{
32
+ jpeg: ArrayBuffer;
33
+ ms: number;
34
+ }>;
@@ -0,0 +1,52 @@
1
+ import { randomUUID } from '../../../chunk-LIPH4O4F.mjs';
2
+
3
+ var PAGE_CAPTURE_REQUEST = "replo:page-capture:request";
4
+ var PAGE_CAPTURE_RESPONSE = "replo:page-capture:response";
5
+ function isPageCaptureRequestMessage(value) {
6
+ return typeof value === "object" && value !== null && "type" in value && value.type === PAGE_CAPTURE_REQUEST && "requestId" in value && typeof value.requestId === "string" && "width" in value && typeof value.width === "number" && "height" in value && typeof value.height === "number";
7
+ }
8
+ function isPageCaptureResponseMessage(value, requestId) {
9
+ return typeof value === "object" && value !== null && "type" in value && value.type === PAGE_CAPTURE_RESPONSE && "requestId" in value && value.requestId === requestId;
10
+ }
11
+ var PageCaptureError = class extends Error {
12
+ };
13
+ function requestPageCapture({
14
+ frame,
15
+ targetOrigin,
16
+ width,
17
+ height,
18
+ timeoutMs = 15e3
19
+ }) {
20
+ const requestId = randomUUID();
21
+ return new Promise((resolve, reject) => {
22
+ const onMessage = (event) => {
23
+ if (event.source !== frame || !isPageCaptureResponseMessage(event.data, requestId)) {
24
+ return;
25
+ }
26
+ cleanup();
27
+ if (event.data.jpeg) {
28
+ resolve({ jpeg: event.data.jpeg, ms: event.data.ms });
29
+ } else {
30
+ reject(new PageCaptureError(event.data.error));
31
+ }
32
+ };
33
+ const timeout = setTimeout(() => {
34
+ cleanup();
35
+ reject(new PageCaptureError("capture timed out"));
36
+ }, timeoutMs);
37
+ const cleanup = () => {
38
+ clearTimeout(timeout);
39
+ window.removeEventListener("message", onMessage);
40
+ };
41
+ window.addEventListener("message", onMessage);
42
+ const request = {
43
+ type: PAGE_CAPTURE_REQUEST,
44
+ requestId,
45
+ width,
46
+ height
47
+ };
48
+ frame.postMessage(request, targetOrigin);
49
+ });
50
+ }
51
+
52
+ export { PAGE_CAPTURE_REQUEST, PAGE_CAPTURE_RESPONSE, PageCaptureError, isPageCaptureRequestMessage, requestPageCapture };
@@ -34,6 +34,17 @@ export type SelectModeBoundingRect = {
34
34
  width: number;
35
35
  height: number;
36
36
  };
37
+ export type SelectModeHoverRect = {
38
+ x: number;
39
+ y: number;
40
+ left: number;
41
+ top: number;
42
+ right: number;
43
+ bottom: number;
44
+ width: number;
45
+ height: number;
46
+ isSection?: boolean;
47
+ };
37
48
  export type SelectModeSelectionRect = {
38
49
  id: string;
39
50
  rect: SelectModeBoundingRect;
@@ -77,6 +88,9 @@ export type SelectModeImage = {
77
88
  export type SelectedElement = {
78
89
  kind: "react-element";
79
90
  selector: string;
91
+ section?: {
92
+ selector: string;
93
+ };
80
94
  tagName: string;
81
95
  elementType: string;
82
96
  textContent: string | null;
@@ -1,4 +1,4 @@
1
- import type { SelectModeBoundingRect, DisplayMode, SelectModeSelectionType, SelectModeOptimisticUpdatePayload, SelectModeFormatCommand, SelectableData, SelectModeClickPosition, SelectModeSelectionRect, SelectModeTiptapActiveMarks } from "./selectMode";
1
+ import type { SelectModeBoundingRect, DisplayMode, SelectModeSelectionType, SelectModeOptimisticUpdatePayload, SelectModeFormatCommand, SelectableData, SelectModeHoverRect, SelectModeClickPosition, SelectModeSelectionRect, SelectModeTiptapActiveMarks } from "./selectMode";
2
2
  export type InlineEditFeedback = {
3
3
  status: "pending" | "unavailable" | "failed";
4
4
  rect: SelectModeBoundingRect;
@@ -11,6 +11,16 @@ export type IframeRuntimeBuildMetadata = {
11
11
  builtAt: string | null;
12
12
  };
13
13
  export type SelectModeParentMessage = {
14
+ method: "expandToSection";
15
+ data: {
16
+ targetSelector: string;
17
+ };
18
+ } | {
19
+ method: "setSectionPreview";
20
+ data: {
21
+ targetSelector: string | null;
22
+ };
23
+ } | {
14
24
  method: "setDisplayMode";
15
25
  data: {
16
26
  displayMode: DisplayMode;
@@ -67,7 +77,7 @@ export type SelectModeIframeMessage = {
67
77
  } | {
68
78
  method: "hoverElement";
69
79
  data: {
70
- rect: SelectModeBoundingRect | null;
80
+ rect: SelectModeHoverRect | null;
71
81
  };
72
82
  } | {
73
83
  method: "selectedElementRectUpdate";
@@ -1,4 +1,4 @@
1
- import { randomUUID } from '../../chunk-SGKQ5HGT.mjs';
1
+ import { randomUUID } from '../../chunk-LIPH4O4F.mjs';
2
2
  import { isNullish } from '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
@@ -46,6 +46,17 @@ export declare const selectModeBoundingRectSchema: z.ZodObject<{
46
46
  width: z.ZodNumber;
47
47
  height: z.ZodNumber;
48
48
  }, z.core.$strip>;
49
+ export declare const selectModeHoverRectSchema: z.ZodObject<{
50
+ x: z.ZodNumber;
51
+ y: z.ZodNumber;
52
+ left: z.ZodNumber;
53
+ top: z.ZodNumber;
54
+ right: z.ZodNumber;
55
+ bottom: z.ZodNumber;
56
+ width: z.ZodNumber;
57
+ height: z.ZodNumber;
58
+ isSection: z.ZodOptional<z.ZodBoolean>;
59
+ }, z.core.$strip>;
49
60
  export declare const selectModeSelectionRectSchema: z.ZodObject<{
50
61
  id: z.ZodString;
51
62
  rect: z.ZodObject<{
@@ -128,6 +139,9 @@ export declare const selectModeImageSchema: z.ZodObject<{
128
139
  export declare const selectedElementSchema: z.ZodObject<{
129
140
  kind: z.ZodLiteral<"react-element">;
130
141
  selector: z.ZodString;
142
+ section: z.ZodOptional<z.ZodObject<{
143
+ selector: z.ZodString;
144
+ }, z.core.$strip>>;
131
145
  tagName: z.ZodString;
132
146
  elementType: z.ZodString;
133
147
  textContent: z.ZodNullable<z.ZodString>;
@@ -226,6 +240,9 @@ export declare const selectableDataPayloadSchema: z.ZodDiscriminatedUnion<[z.Zod
226
240
  export declare const selectableDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
227
241
  kind: z.ZodLiteral<"react-element">;
228
242
  selector: z.ZodString;
243
+ section: z.ZodOptional<z.ZodObject<{
244
+ selector: z.ZodString;
245
+ }, z.core.$strip>>;
229
246
  tagName: z.ZodString;
230
247
  elementType: z.ZodString;
231
248
  textContent: z.ZodNullable<z.ZodString>;
@@ -314,6 +331,7 @@ export type SelectModeBoundingRect = z.infer<typeof selectModeBoundingRectSchema
314
331
  export type SelectModeClickPosition = z.infer<typeof selectModeClickPositionSchema>;
315
332
  export type SelectableData = z.infer<typeof selectableDataSchema>;
316
333
  export type SelectableDataPayload = z.infer<typeof selectableDataPayloadSchema>;
334
+ export declare function isSelectedSection(data: SelectableData): boolean;
317
335
  export declare function transformSelectedElement({ element, offset, scale, }: {
318
336
  element: z.infer<typeof selectedElementSchema>;
319
337
  offset: RectOffset;
@@ -389,9 +407,9 @@ export declare const selectModeFormatCommandSchema: z.ZodEnum<{
389
407
  * Renaming or adding a variant here is a TS error in all three.
390
408
  */
391
409
  export declare const selectModeSelectionTypeSchema: z.ZodEnum<{
392
- element: "element";
393
- area: "area";
394
410
  drag: "drag";
411
+ area: "area";
412
+ element: "element";
395
413
  none: "none";
396
414
  }>;
397
415
  /**
@@ -418,6 +436,9 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
418
436
  data: z.ZodDiscriminatedUnion<[z.ZodObject<{
419
437
  kind: z.ZodLiteral<"react-element">;
420
438
  selector: z.ZodString;
439
+ section: z.ZodOptional<z.ZodObject<{
440
+ selector: z.ZodString;
441
+ }, z.core.$strip>>;
421
442
  tagName: z.ZodString;
422
443
  elementType: z.ZodString;
423
444
  textContent: z.ZodNullable<z.ZodString>;
@@ -517,6 +538,9 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
517
538
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
518
539
  kind: z.ZodLiteral<"react-element">;
519
540
  selector: z.ZodString;
541
+ section: z.ZodOptional<z.ZodObject<{
542
+ selector: z.ZodString;
543
+ }, z.core.$strip>>;
520
544
  tagName: z.ZodString;
521
545
  elementType: z.ZodString;
522
546
  textContent: z.ZodNullable<z.ZodString>;
@@ -1,4 +1,4 @@
1
- export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-XWNBKE63.mjs';
1
+ export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, isSelectedSection, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeHoverRectSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement } from '../../chunk-PJBGUXBG.mjs';
2
2
  import '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
@@ -37,6 +37,7 @@ export declare const selectModeEventInputSchemas: {
37
37
  bottom: z.ZodNumber;
38
38
  width: z.ZodNumber;
39
39
  height: z.ZodNumber;
40
+ isSection: z.ZodOptional<z.ZodBoolean>;
40
41
  }, z.core.$strip>>;
41
42
  }, z.core.$strip>;
42
43
  areaSelection: z.ZodObject<{
@@ -53,6 +54,9 @@ export declare const selectModeEventInputSchemas: {
53
54
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
54
55
  kind: z.ZodLiteral<"react-element">;
55
56
  selector: z.ZodString;
57
+ section: z.ZodOptional<z.ZodObject<{
58
+ selector: z.ZodString;
59
+ }, z.core.$strip>>;
56
60
  tagName: z.ZodString;
57
61
  elementType: z.ZodString;
58
62
  textContent: z.ZodNullable<z.ZodString>;
@@ -175,10 +179,25 @@ export declare const selectModeEventInputSchemas: {
175
179
  }, z.core.$strip>;
176
180
  };
177
181
  export declare const websiteBuilderToPreviewIframeMethodConfig: {
182
+ expandToSection: {
183
+ inputSchema: z.ZodObject<{
184
+ targetSelector: z.ZodString;
185
+ }, z.core.$strip>;
186
+ outputSchema: z.ZodVoid;
187
+ };
188
+ setSectionPreview: {
189
+ inputSchema: z.ZodObject<{
190
+ targetSelector: z.ZodNullable<z.ZodString>;
191
+ }, z.core.$strip>;
192
+ outputSchema: z.ZodVoid;
193
+ };
178
194
  symbolicateSelectedElement: {
179
195
  inputSchema: z.ZodObject<{
180
196
  kind: z.ZodLiteral<"react-element">;
181
197
  selector: z.ZodString;
198
+ section: z.ZodOptional<z.ZodObject<{
199
+ selector: z.ZodString;
200
+ }, z.core.$strip>>;
182
201
  tagName: z.ZodString;
183
202
  elementType: z.ZodString;
184
203
  textContent: z.ZodNullable<z.ZodString>;
@@ -252,6 +271,9 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
252
271
  outputSchema: z.ZodObject<{
253
272
  kind: z.ZodLiteral<"react-element">;
254
273
  selector: z.ZodString;
274
+ section: z.ZodOptional<z.ZodObject<{
275
+ selector: z.ZodString;
276
+ }, z.core.$strip>>;
255
277
  tagName: z.ZodString;
256
278
  elementType: z.ZodString;
257
279
  textContent: z.ZodNullable<z.ZodString>;
@@ -342,9 +364,9 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
342
364
  setSelectionType: {
343
365
  inputSchema: z.ZodObject<{
344
366
  selectionType: z.ZodEnum<{
345
- element: "element";
346
- area: "area";
347
367
  drag: "drag";
368
+ area: "area";
369
+ element: "element";
348
370
  none: "none";
349
371
  }>;
350
372
  selectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -444,6 +466,9 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
444
466
  element: z.ZodObject<{
445
467
  kind: z.ZodLiteral<"react-element">;
446
468
  selector: z.ZodString;
469
+ section: z.ZodOptional<z.ZodObject<{
470
+ selector: z.ZodString;
471
+ }, z.core.$strip>>;
447
472
  tagName: z.ZodString;
448
473
  elementType: z.ZodString;
449
474
  textContent: z.ZodNullable<z.ZodString>;
@@ -535,6 +560,9 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
535
560
  data: z.ZodDiscriminatedUnion<[z.ZodObject<{
536
561
  kind: z.ZodLiteral<"react-element">;
537
562
  selector: z.ZodString;
563
+ section: z.ZodOptional<z.ZodObject<{
564
+ selector: z.ZodString;
565
+ }, z.core.$strip>>;
538
566
  tagName: z.ZodString;
539
567
  elementType: z.ZodString;
540
568
  textContent: z.ZodNullable<z.ZodString>;
@@ -633,6 +661,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
633
661
  bottom: z.ZodNumber;
634
662
  width: z.ZodNumber;
635
663
  height: z.ZodNumber;
664
+ isSection: z.ZodOptional<z.ZodBoolean>;
636
665
  }, z.core.$strip>>;
637
666
  }, z.core.$strip>;
638
667
  outputSchema: z.ZodVoid;
@@ -714,6 +743,9 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
714
743
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
715
744
  kind: z.ZodLiteral<"react-element">;
716
745
  selector: z.ZodString;
746
+ section: z.ZodOptional<z.ZodObject<{
747
+ selector: z.ZodString;
748
+ }, z.core.$strip>>;
717
749
  tagName: z.ZodString;
718
750
  elementType: z.ZodString;
719
751
  textContent: z.ZodNullable<z.ZodString>;
@@ -851,6 +883,16 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
851
883
  };
852
884
  };
853
885
  export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
886
+ method: z.ZodLiteral<"expandToSection">;
887
+ data: z.ZodObject<{
888
+ targetSelector: z.ZodString;
889
+ }, z.core.$strip>;
890
+ }, z.core.$strip>, z.ZodObject<{
891
+ method: z.ZodLiteral<"setSectionPreview">;
892
+ data: z.ZodObject<{
893
+ targetSelector: z.ZodNullable<z.ZodString>;
894
+ }, z.core.$strip>;
895
+ }, z.core.$strip>, z.ZodObject<{
854
896
  method: z.ZodLiteral<"setDisplayMode">;
855
897
  data: z.ZodObject<{
856
898
  displayMode: z.ZodEnum<{
@@ -862,9 +904,9 @@ export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.Z
862
904
  method: z.ZodLiteral<"setSelectionType">;
863
905
  data: z.ZodObject<{
864
906
  selectionType: z.ZodEnum<{
865
- element: "element";
866
- area: "area";
867
907
  drag: "drag";
908
+ area: "area";
909
+ element: "element";
868
910
  none: "none";
869
911
  }>;
870
912
  selectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -961,6 +1003,9 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
961
1003
  data: z.ZodDiscriminatedUnion<[z.ZodObject<{
962
1004
  kind: z.ZodLiteral<"react-element">;
963
1005
  selector: z.ZodString;
1006
+ section: z.ZodOptional<z.ZodObject<{
1007
+ selector: z.ZodString;
1008
+ }, z.core.$strip>>;
964
1009
  tagName: z.ZodString;
965
1010
  elementType: z.ZodString;
966
1011
  textContent: z.ZodNullable<z.ZodString>;
@@ -1058,6 +1103,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1058
1103
  bottom: z.ZodNumber;
1059
1104
  width: z.ZodNumber;
1060
1105
  height: z.ZodNumber;
1106
+ isSection: z.ZodOptional<z.ZodBoolean>;
1061
1107
  }, z.core.$strip>>;
1062
1108
  }, z.core.$strip>;
1063
1109
  }, z.core.$strip>, z.ZodObject<{
@@ -1135,6 +1181,9 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
1135
1181
  items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1136
1182
  kind: z.ZodLiteral<"react-element">;
1137
1183
  selector: z.ZodString;
1184
+ section: z.ZodOptional<z.ZodObject<{
1185
+ selector: z.ZodString;
1186
+ }, z.core.$strip>>;
1138
1187
  tagName: z.ZodString;
1139
1188
  elementType: z.ZodString;
1140
1189
  textContent: z.ZodNullable<z.ZodString>;
@@ -1,4 +1,4 @@
1
- import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-XWNBKE63.mjs';
1
+ import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-PJBGUXBG.mjs';
2
2
  import '../../chunk-JUKCUPQ6.mjs';
3
3
  import '../../chunk-FLYEIRFK.mjs';
4
4
  import '../../chunk-TESFJQID.mjs';
@@ -20,7 +20,7 @@ var iframeRuntimeBuildMetadataSchema = z.object({
20
20
  }).describe("IframeRuntimeBuildMetadata");
21
21
  var selectModeEventInputSchemas = {
22
22
  hover: z.object({
23
- rect: selectModeBoundingRectSchema.nullable()
23
+ rect: selectModeHoverRectSchema.nullable()
24
24
  }),
25
25
  areaSelection: z.object({
26
26
  rect: selectModeBoundingRectSchema,
@@ -37,6 +37,14 @@ var selectModeEventInputSchemas = {
37
37
  })
38
38
  };
39
39
  var websiteBuilderToPreviewIframeMethodConfig = {
40
+ expandToSection: {
41
+ inputSchema: z.object({ targetSelector: z.string() }),
42
+ outputSchema: z.void()
43
+ },
44
+ setSectionPreview: {
45
+ inputSchema: z.object({ targetSelector: z.string().nullable() }),
46
+ outputSchema: z.void()
47
+ },
40
48
  symbolicateSelectedElement: {
41
49
  inputSchema: selectedElementSchema,
42
50
  outputSchema: selectedElementSchema,
@@ -168,6 +176,14 @@ var previewIframeToWebsiteBuilderMethodConfig = {
168
176
  }
169
177
  };
170
178
  var selectModeParentMessageSchema = z.discriminatedUnion("method", [
179
+ z.object({
180
+ method: z.literal("expandToSection"),
181
+ data: websiteBuilderToPreviewIframeMethodConfig.expandToSection.inputSchema
182
+ }),
183
+ z.object({
184
+ method: z.literal("setSectionPreview"),
185
+ data: websiteBuilderToPreviewIframeMethodConfig.setSectionPreview.inputSchema
186
+ }),
171
187
  z.object({
172
188
  method: z.literal("setDisplayMode"),
173
189
  data: websiteBuilderToPreviewIframeMethodConfig.setDisplayMode.inputSchema
@@ -1,8 +1,12 @@
1
1
  function getImageEditSnapshot(image, baseURI) {
2
- if (!image) return null;
2
+ if (!image) {
3
+ return null;
4
+ }
3
5
  const baseUrl = baseURI ?? (URL.canParse(image.currentSrc) ? image.currentSrc : "https://replo.invalid");
4
6
  const normalizeUrl = (url) => {
5
- if (!url) return url;
7
+ if (!url) {
8
+ return url;
9
+ }
6
10
  try {
7
11
  const parsed = new URL(url, baseUrl);
8
12
  const original = parsed.pathname.endsWith("/_next/image") ? parsed.searchParams.get("url") : null;
package/buildMetadata.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sandbox-runtime",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "branch": "HEAD",
5
- "commit": "6ad933540e110b76d214b8700e7a356a551c869a",
6
- "builtAt": "2026-09-24T18:57:19.451Z"
5
+ "commit": "604d707e41cac581b43e134371e5e9a0f78fa2b7",
6
+ "builtAt": "2026-09-25T19:36:00.140Z"
7
7
  };
@@ -0,0 +1,11 @@
1
+ export declare function parseYouTubeId(src: string): string | null;
2
+ export declare function parseVimeoId(src: string): string | null;
3
+ /**
4
+ * Draws the page's first screen (from the document top, regardless of scroll)
5
+ * into an exact width×height JPEG. Videos and YouTube/Vimeo embeds, which the
6
+ * page cannot read directly, are swapped for their current frame or thumbnail.
7
+ */
8
+ export declare function capturePage({ width, height, }: {
9
+ width: number;
10
+ height: number;
11
+ }): Promise<Blob>;