@replohq/sandbox-runtime 1.9.0 → 1.10.1
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/fonts.mjs +18 -6
- package/_vendor/schemas/generated/selectMode.d.ts +15 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +12 -2
- package/_vendor/schemas/selectMode.d.ts +28 -0
- package/_vendor/schemas/selectMode.mjs +1 -1
- package/_vendor/schemas/selectModeIframeRpc.d.ts +57 -0
- package/_vendor/schemas/selectModeIframeRpc.mjs +18 -2
- package/_vendor/schemas/selectModeImage.mjs +6 -2
- package/buildMetadata.js +3 -3
- package/{chunk-XWNBKE63.mjs → chunk-NBVMONRN.mjs} +7 -1
- package/design-library-preview/DesignLibraryPreview.js +18 -6
- package/package.json +4 -4
- package/select-mode/EditorSelection.js +21 -4
- package/select-mode/SelectionFrames.js +56 -23
- package/select-mode/descriptor/elementDescriptor.d.ts +2 -1
- package/select-mode/descriptor/elementDescriptor.js +61 -14
- package/select-mode/hooks/useOptimisticOverrides.js +18 -6
- package/select-mode/hooks/useParentMessaging.d.ts +7 -1
- package/select-mode/hooks/useParentMessaging.js +6 -0
- package/select-mode/hooks/useSelectionHover.js +38 -15
- package/select-mode/hooks/useSelectionInteractions.js +11 -37
- package/select-mode/hooks/useSelectionScrollSync.js +5 -1
- package/select-mode/iframeRpcChannel.d.ts +13 -0
- package/select-mode/iframeRpcChannel.js +2 -0
- package/select-mode/imageOverridePreview.js +14 -5
- package/select-mode/imageSources.js +2 -1
- package/select-mode/inlineEditFeedback.js +9 -3
- package/select-mode/interactions/sectionGeometry.d.ts +3 -0
- package/select-mode/interactions/sectionGeometry.js +200 -0
- package/select-mode/selectModeStore.d.ts +36 -8
- package/select-mode/selectModeStore.js +141 -21
- package/select-mode/selectionFrame.d.ts +3 -1
- package/select-mode/selectionFrame.js +4 -0
|
@@ -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")
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
if (normalized === "
|
|
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"))
|
|
196
|
-
|
|
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
|
}
|
|
@@ -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,9 +88,13 @@ 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;
|
|
97
|
+
sectionLabel?: string;
|
|
83
98
|
rect: SelectModeBoundingRect;
|
|
84
99
|
textMetrics: SelectModeTextMetrics | null;
|
|
85
100
|
outerHTML: string;
|
|
@@ -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:
|
|
80
|
+
rect: SelectModeHoverRect | null;
|
|
71
81
|
};
|
|
72
82
|
} | {
|
|
73
83
|
method: "selectedElementRectUpdate";
|
|
@@ -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,9 +139,13 @@ 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>;
|
|
148
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
134
149
|
rect: z.ZodObject<{
|
|
135
150
|
x: z.ZodNumber;
|
|
136
151
|
y: z.ZodNumber;
|
|
@@ -226,9 +241,13 @@ export declare const selectableDataPayloadSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
226
241
|
export declare const selectableDataSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
227
242
|
kind: z.ZodLiteral<"react-element">;
|
|
228
243
|
selector: z.ZodString;
|
|
244
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
245
|
+
selector: z.ZodString;
|
|
246
|
+
}, z.core.$strip>>;
|
|
229
247
|
tagName: z.ZodString;
|
|
230
248
|
elementType: z.ZodString;
|
|
231
249
|
textContent: z.ZodNullable<z.ZodString>;
|
|
250
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
232
251
|
rect: z.ZodObject<{
|
|
233
252
|
x: z.ZodNumber;
|
|
234
253
|
y: z.ZodNumber;
|
|
@@ -314,6 +333,7 @@ export type SelectModeBoundingRect = z.infer<typeof selectModeBoundingRectSchema
|
|
|
314
333
|
export type SelectModeClickPosition = z.infer<typeof selectModeClickPositionSchema>;
|
|
315
334
|
export type SelectableData = z.infer<typeof selectableDataSchema>;
|
|
316
335
|
export type SelectableDataPayload = z.infer<typeof selectableDataPayloadSchema>;
|
|
336
|
+
export declare function isSelectedSection(data: SelectableData): boolean;
|
|
317
337
|
export declare function transformSelectedElement({ element, offset, scale, }: {
|
|
318
338
|
element: z.infer<typeof selectedElementSchema>;
|
|
319
339
|
offset: RectOffset;
|
|
@@ -418,9 +438,13 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
418
438
|
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
419
439
|
kind: z.ZodLiteral<"react-element">;
|
|
420
440
|
selector: z.ZodString;
|
|
441
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
442
|
+
selector: z.ZodString;
|
|
443
|
+
}, z.core.$strip>>;
|
|
421
444
|
tagName: z.ZodString;
|
|
422
445
|
elementType: z.ZodString;
|
|
423
446
|
textContent: z.ZodNullable<z.ZodString>;
|
|
447
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
424
448
|
rect: z.ZodObject<{
|
|
425
449
|
x: z.ZodNumber;
|
|
426
450
|
y: z.ZodNumber;
|
|
@@ -517,9 +541,13 @@ export declare const selectModeSelectionSchema: z.ZodDiscriminatedUnion<[z.ZodOb
|
|
|
517
541
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
518
542
|
kind: z.ZodLiteral<"react-element">;
|
|
519
543
|
selector: z.ZodString;
|
|
544
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
545
|
+
selector: z.ZodString;
|
|
546
|
+
}, z.core.$strip>>;
|
|
520
547
|
tagName: z.ZodString;
|
|
521
548
|
elementType: z.ZodString;
|
|
522
549
|
textContent: z.ZodNullable<z.ZodString>;
|
|
550
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
523
551
|
rect: z.ZodObject<{
|
|
524
552
|
x: z.ZodNumber;
|
|
525
553
|
y: z.ZodNumber;
|
|
@@ -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-
|
|
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-NBVMONRN.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,9 +54,13 @@ 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>;
|
|
63
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
59
64
|
rect: z.ZodObject<{
|
|
60
65
|
x: z.ZodNumber;
|
|
61
66
|
y: z.ZodNumber;
|
|
@@ -175,13 +180,29 @@ export declare const selectModeEventInputSchemas: {
|
|
|
175
180
|
}, z.core.$strip>;
|
|
176
181
|
};
|
|
177
182
|
export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
183
|
+
expandToSection: {
|
|
184
|
+
inputSchema: z.ZodObject<{
|
|
185
|
+
targetSelector: z.ZodString;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
outputSchema: z.ZodVoid;
|
|
188
|
+
};
|
|
189
|
+
setSectionPreview: {
|
|
190
|
+
inputSchema: z.ZodObject<{
|
|
191
|
+
targetSelector: z.ZodNullable<z.ZodString>;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
outputSchema: z.ZodVoid;
|
|
194
|
+
};
|
|
178
195
|
symbolicateSelectedElement: {
|
|
179
196
|
inputSchema: z.ZodObject<{
|
|
180
197
|
kind: z.ZodLiteral<"react-element">;
|
|
181
198
|
selector: z.ZodString;
|
|
199
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
selector: z.ZodString;
|
|
201
|
+
}, z.core.$strip>>;
|
|
182
202
|
tagName: z.ZodString;
|
|
183
203
|
elementType: z.ZodString;
|
|
184
204
|
textContent: z.ZodNullable<z.ZodString>;
|
|
205
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
185
206
|
rect: z.ZodObject<{
|
|
186
207
|
x: z.ZodNumber;
|
|
187
208
|
y: z.ZodNumber;
|
|
@@ -252,9 +273,13 @@ export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
|
252
273
|
outputSchema: z.ZodObject<{
|
|
253
274
|
kind: z.ZodLiteral<"react-element">;
|
|
254
275
|
selector: z.ZodString;
|
|
276
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
selector: z.ZodString;
|
|
278
|
+
}, z.core.$strip>>;
|
|
255
279
|
tagName: z.ZodString;
|
|
256
280
|
elementType: z.ZodString;
|
|
257
281
|
textContent: z.ZodNullable<z.ZodString>;
|
|
282
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
258
283
|
rect: z.ZodObject<{
|
|
259
284
|
x: z.ZodNumber;
|
|
260
285
|
y: z.ZodNumber;
|
|
@@ -444,9 +469,13 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
444
469
|
element: z.ZodObject<{
|
|
445
470
|
kind: z.ZodLiteral<"react-element">;
|
|
446
471
|
selector: z.ZodString;
|
|
472
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
473
|
+
selector: z.ZodString;
|
|
474
|
+
}, z.core.$strip>>;
|
|
447
475
|
tagName: z.ZodString;
|
|
448
476
|
elementType: z.ZodString;
|
|
449
477
|
textContent: z.ZodNullable<z.ZodString>;
|
|
478
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
450
479
|
rect: z.ZodObject<{
|
|
451
480
|
x: z.ZodNumber;
|
|
452
481
|
y: z.ZodNumber;
|
|
@@ -535,9 +564,13 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
535
564
|
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
536
565
|
kind: z.ZodLiteral<"react-element">;
|
|
537
566
|
selector: z.ZodString;
|
|
567
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
568
|
+
selector: z.ZodString;
|
|
569
|
+
}, z.core.$strip>>;
|
|
538
570
|
tagName: z.ZodString;
|
|
539
571
|
elementType: z.ZodString;
|
|
540
572
|
textContent: z.ZodNullable<z.ZodString>;
|
|
573
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
541
574
|
rect: z.ZodObject<{
|
|
542
575
|
x: z.ZodNumber;
|
|
543
576
|
y: z.ZodNumber;
|
|
@@ -633,6 +666,7 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
633
666
|
bottom: z.ZodNumber;
|
|
634
667
|
width: z.ZodNumber;
|
|
635
668
|
height: z.ZodNumber;
|
|
669
|
+
isSection: z.ZodOptional<z.ZodBoolean>;
|
|
636
670
|
}, z.core.$strip>>;
|
|
637
671
|
}, z.core.$strip>;
|
|
638
672
|
outputSchema: z.ZodVoid;
|
|
@@ -714,9 +748,13 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
714
748
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
715
749
|
kind: z.ZodLiteral<"react-element">;
|
|
716
750
|
selector: z.ZodString;
|
|
751
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
752
|
+
selector: z.ZodString;
|
|
753
|
+
}, z.core.$strip>>;
|
|
717
754
|
tagName: z.ZodString;
|
|
718
755
|
elementType: z.ZodString;
|
|
719
756
|
textContent: z.ZodNullable<z.ZodString>;
|
|
757
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
720
758
|
rect: z.ZodObject<{
|
|
721
759
|
x: z.ZodNumber;
|
|
722
760
|
y: z.ZodNumber;
|
|
@@ -851,6 +889,16 @@ export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
|
851
889
|
};
|
|
852
890
|
};
|
|
853
891
|
export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
892
|
+
method: z.ZodLiteral<"expandToSection">;
|
|
893
|
+
data: z.ZodObject<{
|
|
894
|
+
targetSelector: z.ZodString;
|
|
895
|
+
}, z.core.$strip>;
|
|
896
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
897
|
+
method: z.ZodLiteral<"setSectionPreview">;
|
|
898
|
+
data: z.ZodObject<{
|
|
899
|
+
targetSelector: z.ZodNullable<z.ZodString>;
|
|
900
|
+
}, z.core.$strip>;
|
|
901
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
854
902
|
method: z.ZodLiteral<"setDisplayMode">;
|
|
855
903
|
data: z.ZodObject<{
|
|
856
904
|
displayMode: z.ZodEnum<{
|
|
@@ -961,9 +1009,13 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
961
1009
|
data: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
962
1010
|
kind: z.ZodLiteral<"react-element">;
|
|
963
1011
|
selector: z.ZodString;
|
|
1012
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
1013
|
+
selector: z.ZodString;
|
|
1014
|
+
}, z.core.$strip>>;
|
|
964
1015
|
tagName: z.ZodString;
|
|
965
1016
|
elementType: z.ZodString;
|
|
966
1017
|
textContent: z.ZodNullable<z.ZodString>;
|
|
1018
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
967
1019
|
rect: z.ZodObject<{
|
|
968
1020
|
x: z.ZodNumber;
|
|
969
1021
|
y: z.ZodNumber;
|
|
@@ -1058,6 +1110,7 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
1058
1110
|
bottom: z.ZodNumber;
|
|
1059
1111
|
width: z.ZodNumber;
|
|
1060
1112
|
height: z.ZodNumber;
|
|
1113
|
+
isSection: z.ZodOptional<z.ZodBoolean>;
|
|
1061
1114
|
}, z.core.$strip>>;
|
|
1062
1115
|
}, z.core.$strip>;
|
|
1063
1116
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -1135,9 +1188,13 @@ export declare const selectModeIframeMessageSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
1135
1188
|
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1136
1189
|
kind: z.ZodLiteral<"react-element">;
|
|
1137
1190
|
selector: z.ZodString;
|
|
1191
|
+
section: z.ZodOptional<z.ZodObject<{
|
|
1192
|
+
selector: z.ZodString;
|
|
1193
|
+
}, z.core.$strip>>;
|
|
1138
1194
|
tagName: z.ZodString;
|
|
1139
1195
|
elementType: z.ZodString;
|
|
1140
1196
|
textContent: z.ZodNullable<z.ZodString>;
|
|
1197
|
+
sectionLabel: z.ZodOptional<z.ZodString>;
|
|
1141
1198
|
rect: z.ZodObject<{
|
|
1142
1199
|
x: z.ZodNumber;
|
|
1143
1200
|
y: z.ZodNumber;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-
|
|
1
|
+
import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-NBVMONRN.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:
|
|
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)
|
|
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)
|
|
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.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-09-
|
|
5
|
+
"commit": "5ce66a48693aaff17decf0e5a29f032c61aa2a12",
|
|
6
|
+
"builtAt": "2026-09-26T19:04:09.729Z"
|
|
7
7
|
};
|
|
@@ -48,6 +48,7 @@ var selectModeBoundingRectSchema = z.object({
|
|
|
48
48
|
width: z.number(),
|
|
49
49
|
height: z.number()
|
|
50
50
|
}).describe("SelectModeBoundingRect");
|
|
51
|
+
var selectModeHoverRectSchema = selectModeBoundingRectSchema.extend({ isSection: z.boolean().optional() }).describe("SelectModeHoverRect");
|
|
51
52
|
var selectModeSelectionRectSchema = z.object({
|
|
52
53
|
id: z.string(),
|
|
53
54
|
rect: selectModeBoundingRectSchema
|
|
@@ -122,9 +123,11 @@ var selectModeImageSchema = z.object({
|
|
|
122
123
|
var selectedElementSchema = z.object({
|
|
123
124
|
kind: z.literal("react-element"),
|
|
124
125
|
selector: z.string(),
|
|
126
|
+
section: z.object({ selector: z.string() }).optional(),
|
|
125
127
|
tagName: z.string(),
|
|
126
128
|
elementType: z.string(),
|
|
127
129
|
textContent: z.string().nullable(),
|
|
130
|
+
sectionLabel: z.string().optional(),
|
|
128
131
|
rect: selectModeBoundingRectSchema,
|
|
129
132
|
textMetrics: selectModeTextMetricsSchema.nullable(),
|
|
130
133
|
outerHTML: z.string(),
|
|
@@ -145,6 +148,9 @@ var selectablePlanDataSchema = z.object({
|
|
|
145
148
|
var selectablePlanPayloadSchema = selectablePlanDataSchema.omit({ rect: true }).describe("SelectablePlanPayload");
|
|
146
149
|
var selectableDataPayloadSchema = z.discriminatedUnion("kind", [selectablePlanPayloadSchema]).describe("SelectableDataPayload");
|
|
147
150
|
var selectableDataSchema = z.discriminatedUnion("kind", [selectedElementSchema, selectablePlanDataSchema]).describe("SelectableData");
|
|
151
|
+
function isSelectedSection(data) {
|
|
152
|
+
return data.kind === "react-element" && data.selector === data.section?.selector;
|
|
153
|
+
}
|
|
148
154
|
function transformSelectedElement({
|
|
149
155
|
element,
|
|
150
156
|
offset,
|
|
@@ -232,4 +238,4 @@ var selectModeSelectionSchema = z.discriminatedUnion("type", [
|
|
|
232
238
|
})
|
|
233
239
|
]).describe("SelectModeSelection");
|
|
234
240
|
|
|
235
|
-
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 };
|
|
241
|
+
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 };
|
|
@@ -14,9 +14,13 @@ function DesignLibraryPreview() {
|
|
|
14
14
|
const ownsDefaultFont = useRef(false);
|
|
15
15
|
useEffect(() => {
|
|
16
16
|
const handleMessage = (event) => {
|
|
17
|
-
if (!isAllowedEditorMessage(event))
|
|
17
|
+
if (!isAllowedEditorMessage(event)) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
18
20
|
const parsed = designLibraryPreviewMessageSchema.safeParse(event.data);
|
|
19
|
-
if (!parsed.success)
|
|
21
|
+
if (!parsed.success) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
20
24
|
const { cssVars, fonts, defaultFontCssVar } = parsed.data;
|
|
21
25
|
const root = document.documentElement;
|
|
22
26
|
const nextVars = { ...cssVars };
|
|
@@ -25,7 +29,9 @@ function DesignLibraryPreview() {
|
|
|
25
29
|
}
|
|
26
30
|
const owned = ownedKeys.current ?? /* @__PURE__ */ new Set();
|
|
27
31
|
for (const key of owned) {
|
|
28
|
-
if (!(key in nextVars))
|
|
32
|
+
if (!(key in nextVars)) {
|
|
33
|
+
root.style.removeProperty(key);
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
36
|
ownedKeys.current = new Set(Object.keys(nextVars));
|
|
31
37
|
for (const [key, value] of Object.entries(nextVars)) {
|
|
@@ -44,7 +50,9 @@ function DesignLibraryPreview() {
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
for (const href of nextHrefs) {
|
|
47
|
-
if (links.has(href))
|
|
53
|
+
if (links.has(href)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
48
56
|
const link = document.createElement("link");
|
|
49
57
|
link.rel = "stylesheet";
|
|
50
58
|
link.href = href;
|
|
@@ -62,9 +70,13 @@ function DesignLibraryPreview() {
|
|
|
62
70
|
}
|
|
63
71
|
}
|
|
64
72
|
for (const font of customFonts) {
|
|
65
|
-
if (!font.faceUrl)
|
|
73
|
+
if (!font.faceUrl) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
66
76
|
const existing = faces.get(font.family);
|
|
67
|
-
if (existing?.url === font.faceUrl)
|
|
77
|
+
if (existing?.url === font.faceUrl) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
68
80
|
existing?.style.remove();
|
|
69
81
|
const style = document.createElement("style");
|
|
70
82
|
style.dataset[FONT_LINK_DATA_KEY] = "";
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sandbox-runtime",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.10.1",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-09-
|
|
8
|
+
"commit": "5ce66a48693aaff17decf0e5a29f032c61aa2a12",
|
|
9
|
+
"builtAt": "2026-09-26T19:04:09.729Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -18,6 +18,8 @@ function EditorSelection() {
|
|
|
18
18
|
const store = useSelectModeStore();
|
|
19
19
|
const displayMode = useDisplayMode();
|
|
20
20
|
const {
|
|
21
|
+
expandToSection,
|
|
22
|
+
setSectionPreview,
|
|
21
23
|
formatCommand,
|
|
22
24
|
postSelectedElementSnapshot,
|
|
23
25
|
revertInlineEdit,
|
|
@@ -38,7 +40,9 @@ function EditorSelection() {
|
|
|
38
40
|
const scheduleSnapshot = () => {
|
|
39
41
|
clearTimeout(refreshTimeout);
|
|
40
42
|
refreshTimeout = setTimeout(() => {
|
|
41
|
-
if (store.getState().editingElement)
|
|
43
|
+
if (store.getState().editingElement) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
42
46
|
if (postSelectedElementSnapshot()) {
|
|
43
47
|
clearTimeout(missingTimeout);
|
|
44
48
|
missingTimeout = void 0;
|
|
@@ -54,15 +58,26 @@ function EditorSelection() {
|
|
|
54
58
|
}, 250);
|
|
55
59
|
};
|
|
56
60
|
const observer = new MutationObserver((records) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
61
|
+
const {
|
|
62
|
+
actions,
|
|
63
|
+
editingElement,
|
|
64
|
+
interactionSession: session,
|
|
65
|
+
sectionPreviewElement
|
|
66
|
+
} = store.getState();
|
|
67
|
+
if (sectionPreviewElement && !sectionPreviewElement.isConnected) {
|
|
68
|
+
actions.setSectionPreview({ targetSelector: null });
|
|
69
|
+
}
|
|
70
|
+
if (editingElement || session.type !== "element") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
59
73
|
if (!session.element.isConnected || records.some((record) => session.element.contains(record.target))) {
|
|
60
74
|
scheduleSnapshot();
|
|
61
75
|
}
|
|
62
76
|
});
|
|
63
77
|
const watchRender = () => {
|
|
64
|
-
if (store.getState().editingElement || store.getState().interactionSession.type !== "element")
|
|
78
|
+
if (store.getState().editingElement || store.getState().interactionSession.type !== "element") {
|
|
65
79
|
return;
|
|
80
|
+
}
|
|
66
81
|
clearTimeout(observationTimeout);
|
|
67
82
|
observer.observe(document.body, {
|
|
68
83
|
subtree: true,
|
|
@@ -118,6 +133,8 @@ function EditorSelection() {
|
|
|
118
133
|
useParentMessaging({
|
|
119
134
|
applyOptimisticUpdate,
|
|
120
135
|
markCommitted,
|
|
136
|
+
onExpandToSection: expandToSection,
|
|
137
|
+
onSetSectionPreview: setSectionPreview,
|
|
121
138
|
onExitEditMode: revertInlineEdit,
|
|
122
139
|
onFormatCommand: formatCommand,
|
|
123
140
|
resolveSessionOverrides,
|