@replohq/sandbox-runtime 1.7.11 → 1.7.13
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/errors.d.ts +1 -0
- package/_vendor/replo-utils/react/zustand.d.ts +0 -2
- package/_vendor/replo-utils/react/zustand.mjs +3 -14
- package/_vendor/schemas/componentPreview.d.ts +16 -0
- package/_vendor/schemas/componentPreview.mjs +12 -3
- package/_vendor/schemas/errors.d.ts +6 -0
- package/_vendor/schemas/generated/componentPreview.d.ts +9 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +1 -8
- package/_vendor/schemas/iframeRpcChannel.mjs +46 -11
- package/_vendor/schemas/selectModeIframeRpc.d.ts +118 -110
- package/_vendor/schemas/selectModeIframeRpc.mjs +42 -44
- package/buildMetadata.js +3 -3
- package/package.json +4 -4
- package/select-mode/hooks/useOptimisticOverrides.js +0 -2
- package/select-mode/iframeRpcChannel.d.ts +3 -3
- package/select-mode/iframeRpcChannel.js +4 -4
- package/select-mode/selectModeStore.d.ts +6 -11
- package/select-mode/selectModeStore.js +9 -9
- package/select-mode/selectionFrame.d.ts +2 -8
- package/select-mode/selectionFrame.js +2 -15
- package/select-mode/useShallowStore.d.ts +2 -0
- package/select-mode/useShallowStore.js +9 -0
|
@@ -80,4 +80,5 @@ export declare function isNetworkErrorMessage(message: string): boolean;
|
|
|
80
80
|
* fallback string or `String(error)`.
|
|
81
81
|
*/
|
|
82
82
|
export declare function getErrorMessage(error: unknown, fallback?: string): string;
|
|
83
|
+
export declare function appendErrorId(detail: string, errorId: string | null | undefined): string;
|
|
83
84
|
export {};
|
|
@@ -2,8 +2,6 @@ import type { StateCreator, StoreApi } from "zustand";
|
|
|
2
2
|
/**
|
|
3
3
|
* Drop-in replacement for zustand's `useStore` that uses shallow equality by default.
|
|
4
4
|
* Use this in context-based stores so all selectors automatically get shallow comparison.
|
|
5
|
-
* Subscribes through React's useSyncExternalStore so the consumer's React is
|
|
6
|
-
* used, not Zustand's nested use-sync-external-store copy.
|
|
7
5
|
*/
|
|
8
6
|
export declare function useShallowStore<StateType, SelectedType>(store: StoreApi<StateType>, selector: (state: StateType) => SelectedType): SelectedType;
|
|
9
7
|
/**
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStore } from 'zustand';
|
|
2
|
+
import { useShallow } from 'zustand/react/shallow';
|
|
2
3
|
import { shallow } from 'zustand/shallow';
|
|
3
4
|
import { createWithEqualityFn } from 'zustand/traditional';
|
|
4
5
|
|
|
5
6
|
function useShallowStore(store, selector) {
|
|
6
|
-
|
|
7
|
-
return useSyncExternalStore(
|
|
8
|
-
store.subscribe,
|
|
9
|
-
() => {
|
|
10
|
-
const next = selector(store.getState());
|
|
11
|
-
if (lastSelectedRef.current !== void 0 && shallow(lastSelectedRef.current, next)) {
|
|
12
|
-
return lastSelectedRef.current;
|
|
13
|
-
}
|
|
14
|
-
lastSelectedRef.current = next;
|
|
15
|
-
return next;
|
|
16
|
-
},
|
|
17
|
-
() => selector(store.getState())
|
|
18
|
-
);
|
|
7
|
+
return useStore(store, useShallow(selector));
|
|
19
8
|
}
|
|
20
9
|
function createShallowStore(initializer) {
|
|
21
10
|
return createWithEqualityFn(initializer, shallow);
|
|
@@ -50,6 +50,13 @@ export declare const componentPreviewComponentSchema: z.ZodObject<{
|
|
|
50
50
|
path: z.ZodString;
|
|
51
51
|
name: z.ZodString;
|
|
52
52
|
}, z.core.$strip>;
|
|
53
|
+
export declare const componentPreviewUsageSchema: z.ZodObject<{
|
|
54
|
+
kind: z.ZodEnum<{
|
|
55
|
+
page: "page";
|
|
56
|
+
layout: "layout";
|
|
57
|
+
}>;
|
|
58
|
+
route: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
53
60
|
export declare const componentPreviewIndexSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
61
|
status: z.ZodLiteral<"unavailable">;
|
|
55
62
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -58,6 +65,13 @@ export declare const componentPreviewIndexSchema: z.ZodDiscriminatedUnion<[z.Zod
|
|
|
58
65
|
path: z.ZodString;
|
|
59
66
|
name: z.ZodString;
|
|
60
67
|
}, z.core.$strip>>;
|
|
68
|
+
usagesByComponentPath: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
69
|
+
kind: z.ZodEnum<{
|
|
70
|
+
page: "page";
|
|
71
|
+
layout: "layout";
|
|
72
|
+
}>;
|
|
73
|
+
route: z.ZodString;
|
|
74
|
+
}, z.core.$strip>>>;
|
|
61
75
|
}, z.core.$strip>], "status">;
|
|
62
76
|
export declare const componentPreviewSourceFileSchema: z.ZodObject<{
|
|
63
77
|
path: z.ZodString;
|
|
@@ -79,4 +93,6 @@ export declare const componentPreviewPreparationSchema: z.ZodDiscriminatedUnion<
|
|
|
79
93
|
pathname: z.ZodString;
|
|
80
94
|
}, z.core.$strip>, z.ZodObject<{
|
|
81
95
|
status: z.ZodLiteral<"siteUpdateRequired">;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
status: z.ZodLiteral<"invalidComponent">;
|
|
82
98
|
}, z.core.$strip>], "status">;
|
|
@@ -86,11 +86,19 @@ var componentPreviewComponentSchema = z.object({
|
|
|
86
86
|
path: componentPreviewPathSchema,
|
|
87
87
|
name: z.string().min(1).max(120)
|
|
88
88
|
}).describe("ComponentPreviewComponent");
|
|
89
|
+
var componentPreviewUsageSchema = z.object({
|
|
90
|
+
kind: z.enum(["page", "layout"]),
|
|
91
|
+
route: z.string().min(1)
|
|
92
|
+
}).describe("ComponentPreviewUsage");
|
|
89
93
|
var componentPreviewIndexSchema = z.discriminatedUnion("status", [
|
|
90
94
|
z.object({ status: z.literal("unavailable") }),
|
|
91
95
|
z.object({
|
|
92
96
|
status: z.literal("ready"),
|
|
93
|
-
components: z.array(componentPreviewComponentSchema)
|
|
97
|
+
components: z.array(componentPreviewComponentSchema),
|
|
98
|
+
usagesByComponentPath: z.record(
|
|
99
|
+
componentPreviewPathSchema,
|
|
100
|
+
z.array(componentPreviewUsageSchema)
|
|
101
|
+
)
|
|
94
102
|
})
|
|
95
103
|
]).describe("ComponentPreviewIndex");
|
|
96
104
|
var componentPreviewSourceFileSchema = z.object({
|
|
@@ -107,7 +115,8 @@ var componentPreviewPreparationSchema = z.discriminatedUnion("status", [
|
|
|
107
115
|
status: z.literal("ready"),
|
|
108
116
|
pathname: z.string().regex(/^\/[A-Za-z0-9/_-]+$/u)
|
|
109
117
|
}),
|
|
110
|
-
z.object({ status: z.literal("siteUpdateRequired") })
|
|
118
|
+
z.object({ status: z.literal("siteUpdateRequired") }),
|
|
119
|
+
z.object({ status: z.literal("invalidComponent") })
|
|
111
120
|
]).describe("ComponentPreviewPreparation");
|
|
112
121
|
|
|
113
|
-
export { COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID, COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION, COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM, MAX_COMPONENT_PREVIEW_PROPS_BYTES, componentPreviewComponentSchema, componentPreviewIndexSchema, componentPreviewPathSchema, componentPreviewPreparationSchema, componentPreviewProductReferenceSchema, componentPreviewPropNameSchema, componentPreviewPropsSchema, componentPreviewSelectionSchema, componentPreviewSourceFileSchema, componentPreviewSourceSchema, componentPreviewToWebsiteBuilderMethodConfig, websiteBuilderToComponentPreviewMethodConfig };
|
|
122
|
+
export { COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_ID, COMPONENT_PREVIEW_IFRAME_RPC_CHANNEL_VERSION, COMPONENT_PREVIEW_PARENT_ORIGIN_PARAM, MAX_COMPONENT_PREVIEW_PROPS_BYTES, componentPreviewComponentSchema, componentPreviewIndexSchema, componentPreviewPathSchema, componentPreviewPreparationSchema, componentPreviewProductReferenceSchema, componentPreviewPropNameSchema, componentPreviewPropsSchema, componentPreviewSelectionSchema, componentPreviewSourceFileSchema, componentPreviewSourceSchema, componentPreviewToWebsiteBuilderMethodConfig, componentPreviewUsageSchema, websiteBuilderToComponentPreviewMethodConfig };
|
|
@@ -436,6 +436,12 @@ export declare class IframeRpcChannelTimeoutError extends IframeRpcChannelError
|
|
|
436
436
|
timeoutMs: number;
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
+
export declare class IframeRpcChannelTargetUnavailableError extends IframeRpcChannelError {
|
|
440
|
+
constructor({ callType, method, }: {
|
|
441
|
+
callType: "notify" | "request" | "response";
|
|
442
|
+
method?: string;
|
|
443
|
+
});
|
|
444
|
+
}
|
|
439
445
|
export declare class IframeRpcChannelRemoteError extends IframeRpcChannelError {
|
|
440
446
|
constructor({ method, message }: {
|
|
441
447
|
method: string;
|
|
@@ -12,6 +12,13 @@ export type ComponentPreviewIndex = {
|
|
|
12
12
|
} | {
|
|
13
13
|
status: "ready";
|
|
14
14
|
components: ComponentPreviewComponent[];
|
|
15
|
+
usagesByComponentPath: {
|
|
16
|
+
[x: string]: ComponentPreviewUsage[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type ComponentPreviewUsage = {
|
|
20
|
+
kind: "page" | "layout";
|
|
21
|
+
route: string;
|
|
15
22
|
};
|
|
16
23
|
export type ComponentPreviewSourceFile = {
|
|
17
24
|
path: string;
|
|
@@ -27,4 +34,6 @@ export type ComponentPreviewPreparation = {
|
|
|
27
34
|
pathname: string;
|
|
28
35
|
} | {
|
|
29
36
|
status: "siteUpdateRequired";
|
|
37
|
+
} | {
|
|
38
|
+
status: "invalidComponent";
|
|
30
39
|
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import type { SelectModeBoundingRect,
|
|
1
|
+
import type { SelectModeBoundingRect, DisplayMode, SelectModeSelectionType, SelectModeOptimisticUpdatePayload, SelectModeFormatCommand, SelectableData, SelectModeClickPosition, SelectModeSelectionRect, SelectModeTiptapActiveMarks } from "./selectMode";
|
|
2
2
|
export type InlineEditFeedback = {
|
|
3
3
|
status: "pending" | "unavailable" | "failed";
|
|
4
4
|
rect: SelectModeBoundingRect;
|
|
5
5
|
};
|
|
6
|
-
export type SelectedComponentEditRequest = {
|
|
7
|
-
siteId: string;
|
|
8
|
-
element: SelectedElement;
|
|
9
|
-
};
|
|
10
6
|
export type IframeRuntimeBuildMetadata = {
|
|
11
7
|
packageName: string;
|
|
12
8
|
version: string;
|
|
@@ -15,9 +11,6 @@ export type IframeRuntimeBuildMetadata = {
|
|
|
15
11
|
builtAt: string | null;
|
|
16
12
|
};
|
|
17
13
|
export type SelectModeParentMessage = {
|
|
18
|
-
method: "editSelectedComponent";
|
|
19
|
-
data: SelectedComponentEditRequest;
|
|
20
|
-
} | {
|
|
21
14
|
method: "setDisplayMode";
|
|
22
15
|
data: {
|
|
23
16
|
displayMode: DisplayMode;
|
|
@@ -116,6 +116,17 @@ var IframeRpcChannelTimeoutError = class extends IframeRpcChannelError {
|
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
|
+
var IframeRpcChannelTargetUnavailableError = class extends IframeRpcChannelError {
|
|
120
|
+
constructor({
|
|
121
|
+
callType,
|
|
122
|
+
method
|
|
123
|
+
}) {
|
|
124
|
+
super({
|
|
125
|
+
message: method ? `RPC target window was unavailable for '${method}'` : "RPC target window was unavailable for a response",
|
|
126
|
+
additionalData: { callType, method }
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
119
130
|
var IframeRpcChannelRemoteError = class extends IframeRpcChannelError {
|
|
120
131
|
constructor({ method, message }) {
|
|
121
132
|
super({
|
|
@@ -247,8 +258,8 @@ function createIframeRpcChannel(options) {
|
|
|
247
258
|
const pendingRequests = /* @__PURE__ */ new Map();
|
|
248
259
|
let subscriberCount = 0;
|
|
249
260
|
let handlerMeta;
|
|
250
|
-
const postMessage = (call2) => {
|
|
251
|
-
|
|
261
|
+
const postMessage = (call2, targetWindow = getTargetWindow()) => {
|
|
262
|
+
targetWindow?.postMessage(
|
|
252
263
|
{
|
|
253
264
|
channelIdentifier,
|
|
254
265
|
version,
|
|
@@ -368,9 +379,6 @@ function createIframeRpcChannel(options) {
|
|
|
368
379
|
pendingRequest.resolve(parsedOutput.data);
|
|
369
380
|
};
|
|
370
381
|
const handleMessage = (event) => {
|
|
371
|
-
if (!isExpectedMessage(event)) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
382
|
const parsedMetadata = z.object({
|
|
375
383
|
channelIdentifier: z.literal(channelIdentifier),
|
|
376
384
|
version: z.literal(version)
|
|
@@ -378,6 +386,15 @@ function createIframeRpcChannel(options) {
|
|
|
378
386
|
if (!parsedMetadata.success) {
|
|
379
387
|
return;
|
|
380
388
|
}
|
|
389
|
+
if (!isExpectedMessage(event)) {
|
|
390
|
+
defaultLogger.error("[iframeRpcChannel] Dropping unexpected message", {
|
|
391
|
+
channelIdentifier,
|
|
392
|
+
version,
|
|
393
|
+
origin: event.origin,
|
|
394
|
+
hasSource: Boolean(event.source)
|
|
395
|
+
});
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
381
398
|
const parsedCall = iframeRpcCallSchema.safeParse(event.data);
|
|
382
399
|
if (!parsedCall.success) {
|
|
383
400
|
return;
|
|
@@ -464,6 +481,15 @@ function createIframeRpcChannel(options) {
|
|
|
464
481
|
new IframeRpcChannelUnsubscribedError({ method })
|
|
465
482
|
);
|
|
466
483
|
}
|
|
484
|
+
const targetWindow = getTargetWindow();
|
|
485
|
+
if (!targetWindow) {
|
|
486
|
+
return Promise.reject(
|
|
487
|
+
new IframeRpcChannelTargetUnavailableError({
|
|
488
|
+
callType: "request",
|
|
489
|
+
method
|
|
490
|
+
})
|
|
491
|
+
);
|
|
492
|
+
}
|
|
467
493
|
const id = randomUUID();
|
|
468
494
|
const timeoutMs = definition.timeoutMs ?? 3e4;
|
|
469
495
|
return new Promise(
|
|
@@ -480,12 +506,21 @@ function createIframeRpcChannel(options) {
|
|
|
480
506
|
reject,
|
|
481
507
|
timeoutId
|
|
482
508
|
});
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
509
|
+
try {
|
|
510
|
+
postMessage(
|
|
511
|
+
{
|
|
512
|
+
type: "request",
|
|
513
|
+
id,
|
|
514
|
+
method,
|
|
515
|
+
data: parsedInput.data
|
|
516
|
+
},
|
|
517
|
+
targetWindow
|
|
518
|
+
);
|
|
519
|
+
} catch (error) {
|
|
520
|
+
clearTimeout(timeoutId);
|
|
521
|
+
pendingRequests.delete(id);
|
|
522
|
+
reject(error);
|
|
523
|
+
}
|
|
489
524
|
}
|
|
490
525
|
);
|
|
491
526
|
};
|
|
@@ -26,15 +26,9 @@ export declare const iframeRuntimeBuildMetadataSchema: z.ZodObject<{
|
|
|
26
26
|
commit: z.ZodNullable<z.ZodString>;
|
|
27
27
|
builtAt: z.ZodNullable<z.ZodString>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
|
-
export declare const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
kind: z.ZodLiteral<"react-element">;
|
|
33
|
-
selector: z.ZodString;
|
|
34
|
-
tagName: z.ZodString;
|
|
35
|
-
elementType: z.ZodString;
|
|
36
|
-
textContent: z.ZodNullable<z.ZodString>;
|
|
37
|
-
rect: z.ZodObject<{
|
|
29
|
+
export declare const selectModeEventInputSchemas: {
|
|
30
|
+
hover: z.ZodObject<{
|
|
31
|
+
rect: z.ZodNullable<z.ZodObject<{
|
|
38
32
|
x: z.ZodNumber;
|
|
39
33
|
y: z.ZodNumber;
|
|
40
34
|
left: z.ZodNumber;
|
|
@@ -43,52 +37,130 @@ export declare const selectedComponentEditRequestSchema: z.ZodObject<{
|
|
|
43
37
|
bottom: z.ZodNumber;
|
|
44
38
|
width: z.ZodNumber;
|
|
45
39
|
height: z.ZodNumber;
|
|
46
|
-
}, z.core.$strip>;
|
|
47
|
-
textMetrics: z.ZodNullable<z.ZodObject<{
|
|
48
|
-
tightWidth: z.ZodNumber;
|
|
49
|
-
lineCount: z.ZodNumber;
|
|
50
|
-
lineHeight: z.ZodNumber;
|
|
51
40
|
}, z.core.$strip>>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
variant: z.ZodNullable<z.ZodObject<{
|
|
56
|
-
atRules: z.ZodArray<z.ZodObject<{
|
|
57
|
-
type: z.ZodString;
|
|
58
|
-
text: z.ZodString;
|
|
59
|
-
}, z.core.$strip>>;
|
|
60
|
-
pseudo: z.ZodNullable<z.ZodString>;
|
|
61
|
-
}, z.core.$strip>>;
|
|
62
|
-
className: z.ZodNullable<z.ZodString>;
|
|
63
|
-
raw: z.ZodString;
|
|
64
|
-
resolved: z.ZodString;
|
|
65
|
-
}, z.core.$strip>>>;
|
|
66
|
-
inheritedStyles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
67
|
-
clickPosition: z.ZodObject<{
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
areaSelection: z.ZodObject<{
|
|
43
|
+
rect: z.ZodObject<{
|
|
68
44
|
x: z.ZodNumber;
|
|
69
45
|
y: z.ZodNumber;
|
|
46
|
+
left: z.ZodNumber;
|
|
47
|
+
top: z.ZodNumber;
|
|
48
|
+
right: z.ZodNumber;
|
|
49
|
+
bottom: z.ZodNumber;
|
|
50
|
+
width: z.ZodNumber;
|
|
51
|
+
height: z.ZodNumber;
|
|
70
52
|
}, z.core.$strip>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
53
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"react-element">;
|
|
55
|
+
selector: z.ZodString;
|
|
56
|
+
tagName: z.ZodString;
|
|
57
|
+
elementType: z.ZodString;
|
|
58
|
+
textContent: z.ZodNullable<z.ZodString>;
|
|
59
|
+
rect: z.ZodObject<{
|
|
60
|
+
x: z.ZodNumber;
|
|
61
|
+
y: z.ZodNumber;
|
|
62
|
+
left: z.ZodNumber;
|
|
63
|
+
top: z.ZodNumber;
|
|
64
|
+
right: z.ZodNumber;
|
|
65
|
+
bottom: z.ZodNumber;
|
|
66
|
+
width: z.ZodNumber;
|
|
67
|
+
height: z.ZodNumber;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
textMetrics: z.ZodNullable<z.ZodObject<{
|
|
70
|
+
tightWidth: z.ZodNumber;
|
|
71
|
+
lineCount: z.ZodNumber;
|
|
72
|
+
lineHeight: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
outerHTML: z.ZodString;
|
|
75
|
+
definedStyles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
76
|
+
property: z.ZodString;
|
|
77
|
+
variant: z.ZodNullable<z.ZodObject<{
|
|
78
|
+
atRules: z.ZodArray<z.ZodObject<{
|
|
79
|
+
type: z.ZodString;
|
|
80
|
+
text: z.ZodString;
|
|
81
|
+
}, z.core.$strip>>;
|
|
82
|
+
pseudo: z.ZodNullable<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
className: z.ZodNullable<z.ZodString>;
|
|
85
|
+
raw: z.ZodString;
|
|
86
|
+
resolved: z.ZodString;
|
|
87
|
+
}, z.core.$strip>>>;
|
|
88
|
+
inheritedStyles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
89
|
+
clickPosition: z.ZodObject<{
|
|
90
|
+
x: z.ZodNumber;
|
|
91
|
+
y: z.ZodNumber;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
sourceLocation: z.ZodOptional<z.ZodObject<{
|
|
79
94
|
filePath: z.ZodString;
|
|
80
95
|
lineNumber: z.ZodNumber;
|
|
81
96
|
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
82
97
|
componentName: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>;
|
|
99
|
+
fiberChain: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
100
|
+
sourceLocation: z.ZodObject<{
|
|
101
|
+
filePath: z.ZodString;
|
|
102
|
+
lineNumber: z.ZodNumber;
|
|
103
|
+
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
componentName: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
tagName: z.ZodOptional<z.ZodString>;
|
|
107
|
+
componentName: z.ZodOptional<z.ZodString>;
|
|
108
|
+
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
109
|
+
}, z.core.$strip>>>;
|
|
110
|
+
siblingSelectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
kind: z.ZodLiteral<"plan">;
|
|
113
|
+
planId: z.ZodString;
|
|
114
|
+
label: z.ZodString;
|
|
115
|
+
rect: z.ZodObject<{
|
|
116
|
+
x: z.ZodNumber;
|
|
117
|
+
y: z.ZodNumber;
|
|
118
|
+
left: z.ZodNumber;
|
|
119
|
+
top: z.ZodNumber;
|
|
120
|
+
right: z.ZodNumber;
|
|
121
|
+
bottom: z.ZodNumber;
|
|
122
|
+
width: z.ZodNumber;
|
|
123
|
+
height: z.ZodNumber;
|
|
83
124
|
}, z.core.$strip>;
|
|
84
|
-
|
|
85
|
-
componentName: z.ZodOptional<z.ZodString>;
|
|
86
|
-
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
87
|
-
}, z.core.$strip>>>;
|
|
88
|
-
siblingSelectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
125
|
+
}, z.core.$strip>], "kind">>;
|
|
89
126
|
}, z.core.$strip>;
|
|
90
|
-
|
|
91
|
-
|
|
127
|
+
dragRect: z.ZodObject<{
|
|
128
|
+
dragRect: z.ZodNullable<z.ZodObject<{
|
|
129
|
+
x: z.ZodNumber;
|
|
130
|
+
y: z.ZodNumber;
|
|
131
|
+
left: z.ZodNumber;
|
|
132
|
+
top: z.ZodNumber;
|
|
133
|
+
right: z.ZodNumber;
|
|
134
|
+
bottom: z.ZodNumber;
|
|
135
|
+
width: z.ZodNumber;
|
|
136
|
+
height: z.ZodNumber;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
selectionRects: z.ZodArray<z.ZodObject<{
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
rect: z.ZodObject<{
|
|
141
|
+
x: z.ZodNumber;
|
|
142
|
+
y: z.ZodNumber;
|
|
143
|
+
left: z.ZodNumber;
|
|
144
|
+
top: z.ZodNumber;
|
|
145
|
+
right: z.ZodNumber;
|
|
146
|
+
bottom: z.ZodNumber;
|
|
147
|
+
width: z.ZodNumber;
|
|
148
|
+
height: z.ZodNumber;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
inlineEditState: z.ZodObject<{
|
|
153
|
+
activeMarks: z.ZodObject<{
|
|
154
|
+
bold: z.ZodBoolean;
|
|
155
|
+
italic: z.ZodBoolean;
|
|
156
|
+
underline: z.ZodBoolean;
|
|
157
|
+
strike: z.ZodBoolean;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
isInlineEditing: z.ZodBoolean;
|
|
160
|
+
isInlineEditPending: z.ZodBoolean;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
|
+
};
|
|
163
|
+
export declare const websiteBuilderToPreviewIframeMethodConfig: {
|
|
92
164
|
symbolicateSelectedElement: {
|
|
93
165
|
inputSchema: z.ZodObject<{
|
|
94
166
|
kind: z.ZodLiteral<"react-element">;
|
|
@@ -307,7 +379,7 @@ export declare const websiteBuilderToCanopyMethodConfig: {
|
|
|
307
379
|
outputSchema: z.ZodVoid;
|
|
308
380
|
};
|
|
309
381
|
};
|
|
310
|
-
export declare const
|
|
382
|
+
export declare const previewIframeToWebsiteBuilderMethodConfig: {
|
|
311
383
|
requestInlineTextEdit: {
|
|
312
384
|
inputSchema: z.ZodObject<{
|
|
313
385
|
editId: z.ZodString;
|
|
@@ -679,70 +751,6 @@ export declare const canopyToWebsiteBuilderMethodConfig: {
|
|
|
679
751
|
};
|
|
680
752
|
};
|
|
681
753
|
export declare const selectModeParentMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
682
|
-
method: z.ZodLiteral<"editSelectedComponent">;
|
|
683
|
-
data: z.ZodObject<{
|
|
684
|
-
siteId: z.ZodUUID;
|
|
685
|
-
element: z.ZodObject<{
|
|
686
|
-
kind: z.ZodLiteral<"react-element">;
|
|
687
|
-
selector: z.ZodString;
|
|
688
|
-
tagName: z.ZodString;
|
|
689
|
-
elementType: z.ZodString;
|
|
690
|
-
textContent: z.ZodNullable<z.ZodString>;
|
|
691
|
-
rect: z.ZodObject<{
|
|
692
|
-
x: z.ZodNumber;
|
|
693
|
-
y: z.ZodNumber;
|
|
694
|
-
left: z.ZodNumber;
|
|
695
|
-
top: z.ZodNumber;
|
|
696
|
-
right: z.ZodNumber;
|
|
697
|
-
bottom: z.ZodNumber;
|
|
698
|
-
width: z.ZodNumber;
|
|
699
|
-
height: z.ZodNumber;
|
|
700
|
-
}, z.core.$strip>;
|
|
701
|
-
textMetrics: z.ZodNullable<z.ZodObject<{
|
|
702
|
-
tightWidth: z.ZodNumber;
|
|
703
|
-
lineCount: z.ZodNumber;
|
|
704
|
-
lineHeight: z.ZodNumber;
|
|
705
|
-
}, z.core.$strip>>;
|
|
706
|
-
outerHTML: z.ZodString;
|
|
707
|
-
definedStyles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
708
|
-
property: z.ZodString;
|
|
709
|
-
variant: z.ZodNullable<z.ZodObject<{
|
|
710
|
-
atRules: z.ZodArray<z.ZodObject<{
|
|
711
|
-
type: z.ZodString;
|
|
712
|
-
text: z.ZodString;
|
|
713
|
-
}, z.core.$strip>>;
|
|
714
|
-
pseudo: z.ZodNullable<z.ZodString>;
|
|
715
|
-
}, z.core.$strip>>;
|
|
716
|
-
className: z.ZodNullable<z.ZodString>;
|
|
717
|
-
raw: z.ZodString;
|
|
718
|
-
resolved: z.ZodString;
|
|
719
|
-
}, z.core.$strip>>>;
|
|
720
|
-
inheritedStyles: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
721
|
-
clickPosition: z.ZodObject<{
|
|
722
|
-
x: z.ZodNumber;
|
|
723
|
-
y: z.ZodNumber;
|
|
724
|
-
}, z.core.$strip>;
|
|
725
|
-
sourceLocation: z.ZodOptional<z.ZodObject<{
|
|
726
|
-
filePath: z.ZodString;
|
|
727
|
-
lineNumber: z.ZodNumber;
|
|
728
|
-
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
729
|
-
componentName: z.ZodOptional<z.ZodString>;
|
|
730
|
-
}, z.core.$strip>>;
|
|
731
|
-
fiberChain: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
732
|
-
sourceLocation: z.ZodObject<{
|
|
733
|
-
filePath: z.ZodString;
|
|
734
|
-
lineNumber: z.ZodNumber;
|
|
735
|
-
columnNumber: z.ZodOptional<z.ZodNumber>;
|
|
736
|
-
componentName: z.ZodOptional<z.ZodString>;
|
|
737
|
-
}, z.core.$strip>;
|
|
738
|
-
tagName: z.ZodOptional<z.ZodString>;
|
|
739
|
-
componentName: z.ZodOptional<z.ZodString>;
|
|
740
|
-
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
741
|
-
}, z.core.$strip>>>;
|
|
742
|
-
siblingSelectors: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
743
|
-
}, z.core.$strip>;
|
|
744
|
-
}, z.core.$strip>;
|
|
745
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
746
754
|
method: z.ZodLiteral<"setDisplayMode">;
|
|
747
755
|
data: z.ZodObject<{
|
|
748
756
|
displayMode: z.ZodEnum<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selectModeBoundingRectSchema,
|
|
1
|
+
import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-4T7WSMC3.mjs';
|
|
2
2
|
import '../../chunk-JUKCUPQ6.mjs';
|
|
3
3
|
import '../../chunk-FLYEIRFK.mjs';
|
|
4
4
|
import '../../chunk-TESFJQID.mjs';
|
|
@@ -18,11 +18,25 @@ var iframeRuntimeBuildMetadataSchema = z.object({
|
|
|
18
18
|
commit: z.string().nullable(),
|
|
19
19
|
builtAt: z.string().nullable()
|
|
20
20
|
}).describe("IframeRuntimeBuildMetadata");
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
})
|
|
25
|
-
|
|
21
|
+
var selectModeEventInputSchemas = {
|
|
22
|
+
hover: z.object({
|
|
23
|
+
rect: selectModeBoundingRectSchema.nullable()
|
|
24
|
+
}),
|
|
25
|
+
areaSelection: z.object({
|
|
26
|
+
rect: selectModeBoundingRectSchema,
|
|
27
|
+
items: z.array(selectableDataSchema)
|
|
28
|
+
}),
|
|
29
|
+
dragRect: z.object({
|
|
30
|
+
dragRect: selectModeBoundingRectSchema.nullable(),
|
|
31
|
+
selectionRects: z.array(selectModeSelectionRectSchema)
|
|
32
|
+
}),
|
|
33
|
+
inlineEditState: z.object({
|
|
34
|
+
activeMarks: selectModeTiptapActiveMarksSchema,
|
|
35
|
+
isInlineEditing: z.boolean(),
|
|
36
|
+
isInlineEditPending: z.boolean()
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
var websiteBuilderToPreviewIframeMethodConfig = {
|
|
26
40
|
symbolicateSelectedElement: {
|
|
27
41
|
inputSchema: selectedElementSchema,
|
|
28
42
|
outputSchema: selectedElementSchema,
|
|
@@ -87,7 +101,7 @@ var websiteBuilderToCanopyMethodConfig = {
|
|
|
87
101
|
outputSchema: z.void()
|
|
88
102
|
}
|
|
89
103
|
};
|
|
90
|
-
var
|
|
104
|
+
var previewIframeToWebsiteBuilderMethodConfig = {
|
|
91
105
|
requestInlineTextEdit: {
|
|
92
106
|
inputSchema: z.object({
|
|
93
107
|
editId: z.string(),
|
|
@@ -107,9 +121,7 @@ var canopyToWebsiteBuilderMethodConfig = {
|
|
|
107
121
|
outputSchema: z.void()
|
|
108
122
|
},
|
|
109
123
|
hoverElement: {
|
|
110
|
-
inputSchema:
|
|
111
|
-
rect: selectModeBoundingRectSchema.nullable()
|
|
112
|
-
}),
|
|
124
|
+
inputSchema: selectModeEventInputSchemas.hover,
|
|
113
125
|
outputSchema: z.void()
|
|
114
126
|
},
|
|
115
127
|
selectedElementRectUpdate: {
|
|
@@ -126,17 +138,11 @@ var canopyToWebsiteBuilderMethodConfig = {
|
|
|
126
138
|
outputSchema: z.void()
|
|
127
139
|
},
|
|
128
140
|
dragRectUpdated: {
|
|
129
|
-
inputSchema:
|
|
130
|
-
dragRect: selectModeBoundingRectSchema.nullable(),
|
|
131
|
-
selectionRects: z.array(selectModeSelectionRectSchema)
|
|
132
|
-
}),
|
|
141
|
+
inputSchema: selectModeEventInputSchemas.dragRect,
|
|
133
142
|
outputSchema: z.void()
|
|
134
143
|
},
|
|
135
144
|
areaSelected: {
|
|
136
|
-
inputSchema:
|
|
137
|
-
rect: selectModeBoundingRectSchema,
|
|
138
|
-
items: z.array(selectableDataSchema)
|
|
139
|
-
}),
|
|
145
|
+
inputSchema: selectModeEventInputSchemas.areaSelection,
|
|
140
146
|
outputSchema: z.void()
|
|
141
147
|
},
|
|
142
148
|
textCommitted: {
|
|
@@ -153,11 +159,7 @@ var canopyToWebsiteBuilderMethodConfig = {
|
|
|
153
159
|
outputSchema: z.void()
|
|
154
160
|
},
|
|
155
161
|
editorStateUpdate: {
|
|
156
|
-
inputSchema:
|
|
157
|
-
activeMarks: selectModeTiptapActiveMarksSchema,
|
|
158
|
-
isInlineEditing: z.boolean(),
|
|
159
|
-
isInlineEditPending: z.boolean()
|
|
160
|
-
}),
|
|
162
|
+
inputSchema: selectModeEventInputSchemas.inlineEditState,
|
|
161
163
|
outputSchema: z.void()
|
|
162
164
|
},
|
|
163
165
|
fastRefreshComplete: {
|
|
@@ -166,33 +168,29 @@ var canopyToWebsiteBuilderMethodConfig = {
|
|
|
166
168
|
}
|
|
167
169
|
};
|
|
168
170
|
var selectModeParentMessageSchema = z.discriminatedUnion("method", [
|
|
169
|
-
z.object({
|
|
170
|
-
method: z.literal("editSelectedComponent"),
|
|
171
|
-
data: selectedComponentEditRequestSchema
|
|
172
|
-
}),
|
|
173
171
|
z.object({
|
|
174
172
|
method: z.literal("setDisplayMode"),
|
|
175
|
-
data:
|
|
173
|
+
data: websiteBuilderToPreviewIframeMethodConfig.setDisplayMode.inputSchema
|
|
176
174
|
}),
|
|
177
175
|
z.object({
|
|
178
176
|
method: z.literal("setSelectionType"),
|
|
179
|
-
data:
|
|
177
|
+
data: websiteBuilderToPreviewIframeMethodConfig.setSelectionType.inputSchema
|
|
180
178
|
}),
|
|
181
179
|
z.object({
|
|
182
180
|
method: z.literal("applyOptimisticUpdate"),
|
|
183
|
-
data:
|
|
181
|
+
data: websiteBuilderToPreviewIframeMethodConfig.applyOptimisticUpdate.inputSchema
|
|
184
182
|
}),
|
|
185
183
|
z.object({
|
|
186
184
|
method: z.literal("markCommitted"),
|
|
187
|
-
data:
|
|
185
|
+
data: websiteBuilderToPreviewIframeMethodConfig.markCommitted.inputSchema
|
|
188
186
|
}),
|
|
189
187
|
z.object({
|
|
190
188
|
method: z.literal("resolveSessionOverrides"),
|
|
191
|
-
data:
|
|
189
|
+
data: websiteBuilderToPreviewIframeMethodConfig.resolveSessionOverrides.inputSchema
|
|
192
190
|
}),
|
|
193
191
|
z.object({
|
|
194
192
|
method: z.literal("revertOverride"),
|
|
195
|
-
data:
|
|
193
|
+
data: websiteBuilderToPreviewIframeMethodConfig.revertOverride.inputSchema
|
|
196
194
|
}),
|
|
197
195
|
z.object({
|
|
198
196
|
method: z.literal("enterEditMode")
|
|
@@ -202,7 +200,7 @@ var selectModeParentMessageSchema = z.discriminatedUnion("method", [
|
|
|
202
200
|
}),
|
|
203
201
|
z.object({
|
|
204
202
|
method: z.literal("formatCommand"),
|
|
205
|
-
data:
|
|
203
|
+
data: websiteBuilderToPreviewIframeMethodConfig.formatCommand.inputSchema
|
|
206
204
|
})
|
|
207
205
|
]).describe("SelectModeParentMessage");
|
|
208
206
|
var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
|
|
@@ -212,43 +210,43 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
|
|
|
212
210
|
}),
|
|
213
211
|
z.object({
|
|
214
212
|
method: z.literal("elementSelected"),
|
|
215
|
-
data:
|
|
213
|
+
data: previewIframeToWebsiteBuilderMethodConfig.elementSelected.inputSchema
|
|
216
214
|
}),
|
|
217
215
|
z.object({
|
|
218
216
|
method: z.literal("hoverElement"),
|
|
219
|
-
data:
|
|
217
|
+
data: previewIframeToWebsiteBuilderMethodConfig.hoverElement.inputSchema
|
|
220
218
|
}),
|
|
221
219
|
z.object({
|
|
222
220
|
method: z.literal("selectedElementRectUpdate"),
|
|
223
|
-
data:
|
|
221
|
+
data: previewIframeToWebsiteBuilderMethodConfig.selectedElementRectUpdate.inputSchema
|
|
224
222
|
}),
|
|
225
223
|
z.object({
|
|
226
224
|
method: z.literal("selectedAreaRectUpdate"),
|
|
227
|
-
data:
|
|
225
|
+
data: previewIframeToWebsiteBuilderMethodConfig.selectedAreaRectUpdate.inputSchema
|
|
228
226
|
}),
|
|
229
227
|
z.object({
|
|
230
228
|
method: z.literal("dragRectUpdated"),
|
|
231
|
-
data:
|
|
229
|
+
data: previewIframeToWebsiteBuilderMethodConfig.dragRectUpdated.inputSchema
|
|
232
230
|
}),
|
|
233
231
|
z.object({
|
|
234
232
|
method: z.literal("areaSelected"),
|
|
235
|
-
data:
|
|
233
|
+
data: previewIframeToWebsiteBuilderMethodConfig.areaSelected.inputSchema
|
|
236
234
|
}),
|
|
237
235
|
z.object({
|
|
238
236
|
method: z.literal("textCommitted"),
|
|
239
|
-
data:
|
|
237
|
+
data: previewIframeToWebsiteBuilderMethodConfig.textCommitted.inputSchema
|
|
240
238
|
}),
|
|
241
239
|
z.object({
|
|
242
240
|
method: z.literal("inlineEditFeedbackChanged"),
|
|
243
|
-
data:
|
|
241
|
+
data: previewIframeToWebsiteBuilderMethodConfig.inlineEditFeedbackChanged.inputSchema
|
|
244
242
|
}),
|
|
245
243
|
z.object({
|
|
246
244
|
method: z.literal("editorStateUpdate"),
|
|
247
|
-
data:
|
|
245
|
+
data: previewIframeToWebsiteBuilderMethodConfig.editorStateUpdate.inputSchema
|
|
248
246
|
}),
|
|
249
247
|
z.object({
|
|
250
248
|
method: z.literal("fastRefreshComplete")
|
|
251
249
|
})
|
|
252
250
|
]).describe("SelectModeIframeMessage");
|
|
253
251
|
|
|
254
|
-
export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,
|
|
252
|
+
export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, previewIframeToWebsiteBuilderMethodConfig, 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.7.
|
|
3
|
+
"version": "1.7.13",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-09-
|
|
5
|
+
"commit": "48e7e55752c4448369b7a49ce608c6539acb3a24",
|
|
6
|
+
"builtAt": "2026-09-23T03:50:04.538Z"
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sandbox-runtime",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.13",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sandbox-runtime",
|
|
6
|
-
"version": "1.7.
|
|
6
|
+
"version": "1.7.13",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-09-
|
|
8
|
+
"commit": "48e7e55752c4448369b7a49ce608c6539acb3a24",
|
|
9
|
+
"builtAt": "2026-09-23T03:50:04.538Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo sandbox runtime — editor integration for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -286,7 +286,6 @@ function useOptimisticOverrides() {
|
|
|
286
286
|
removeOverride({ editId, outcome: "failed" });
|
|
287
287
|
}, OVERRIDE_REGISTRATION_TIMEOUT_MS),
|
|
288
288
|
sessionId: null,
|
|
289
|
-
state: "live",
|
|
290
289
|
targets: elements.map((element) => ({
|
|
291
290
|
element,
|
|
292
291
|
originalState: getOriginalState({ element, payload }),
|
|
@@ -317,7 +316,6 @@ function useOptimisticOverrides() {
|
|
|
317
316
|
}
|
|
318
317
|
clearTimeout(override.registrationTimeout);
|
|
319
318
|
override.sessionId = sessionId;
|
|
320
|
-
override.state = "fired";
|
|
321
319
|
const outcome = getSessionOutcomes().get(sessionId);
|
|
322
320
|
if (outcome) {
|
|
323
321
|
removeOverride({ editId, outcome });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SelectedElement } from "../_vendor/schemas/generated/selectMode";
|
|
2
2
|
import type { IframeRpcChannelInputHandlers, IframeRpcChannelRemote } from "../_vendor/schemas/iframeRpcChannel";
|
|
3
|
-
import {
|
|
4
|
-
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof
|
|
5
|
-
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof
|
|
3
|
+
import { previewIframeToWebsiteBuilderMethodConfig, websiteBuilderToPreviewIframeMethodConfig } from "../_vendor/schemas/selectModeIframeRpc";
|
|
4
|
+
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof previewIframeToWebsiteBuilderMethodConfig>;
|
|
5
|
+
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToPreviewIframeMethodConfig>, "symbolicateSelectedElement" | "navigateToRoute">;
|
|
6
6
|
export declare function setNavigateToRouteHandler(handler: ((input: {
|
|
7
7
|
pathname: string;
|
|
8
8
|
}) => void) | null): void;
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
createIframeRpcRemote
|
|
4
4
|
} from "../_vendor/schemas/iframeRpcChannel.mjs";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
previewIframeToWebsiteBuilderMethodConfig,
|
|
7
7
|
SELECT_MODE_IFRAME_RPC_CHANNEL_ID,
|
|
8
8
|
SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,
|
|
9
|
-
|
|
9
|
+
websiteBuilderToPreviewIframeMethodConfig
|
|
10
10
|
} from "../_vendor/schemas/selectModeIframeRpc.mjs";
|
|
11
11
|
import { symbolicateSelectedElement } from "./symbolicate";
|
|
12
12
|
let messagingHandlers = null;
|
|
@@ -22,8 +22,8 @@ function createSelectModeIframeRpcChannel() {
|
|
|
22
22
|
getTargetWindow: () => window.parent === window ? null : window.parent,
|
|
23
23
|
targetOrigin: "*",
|
|
24
24
|
isExpectedMessage: (event) => event.source === window.parent,
|
|
25
|
-
outgoingMethods:
|
|
26
|
-
incomingMethods:
|
|
25
|
+
outgoingMethods: previewIframeToWebsiteBuilderMethodConfig,
|
|
26
|
+
incomingMethods: websiteBuilderToPreviewIframeMethodConfig,
|
|
27
27
|
handlers: {
|
|
28
28
|
setDisplayMode: (input) => {
|
|
29
29
|
messagingHandlers?.setDisplayMode(input);
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import type { DisplayMode, SelectableData, SelectModeBoundingRect, SelectModeFormatCommand, SelectModeSelectionType } from "../_vendor/schemas/generated/selectMode";
|
|
1
|
+
import type { DisplayMode, SelectableData, SelectModeBoundingRect, SelectModeFormatCommand, SelectModeSelectionType, SelectModeTiptapActiveMarks } from "../_vendor/schemas/generated/selectMode";
|
|
2
2
|
import type { InlineEditFeedback } from "../_vendor/schemas/generated/selectModeIframeRpc";
|
|
3
3
|
import type { DragCandidate } from "./interactions/selectionGeometry";
|
|
4
4
|
import type { SelectionFrameSpec } from "./selectionFrame";
|
|
5
5
|
import type { SelectModeInteractionSession } from "./selectModeSession";
|
|
6
6
|
import type { InlineTiptapEditor } from "./tiptapInlineEditor";
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
italic: boolean;
|
|
10
|
-
underline: boolean;
|
|
11
|
-
strike: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare const EMPTY_ACTIVE_MARKS: ActiveMarks;
|
|
14
|
-
type InlineEditRequest = {
|
|
7
|
+
export declare const EMPTY_ACTIVE_MARKS: SelectModeTiptapActiveMarks;
|
|
8
|
+
type InlineEditDraft = {
|
|
15
9
|
status: "pending";
|
|
16
10
|
editId: string;
|
|
17
11
|
element: HTMLElement;
|
|
18
12
|
timeout: number;
|
|
19
|
-
stopFeedback: () => void;
|
|
20
13
|
} | {
|
|
21
14
|
status: Exclude<InlineEditFeedback["status"], "pending">;
|
|
22
15
|
element: HTMLElement;
|
|
16
|
+
};
|
|
17
|
+
type InlineEditRequest = InlineEditDraft & {
|
|
23
18
|
stopFeedback: () => void;
|
|
24
19
|
};
|
|
25
20
|
type LastClick = {
|
|
@@ -52,7 +47,7 @@ interface SelectModeStoreState {
|
|
|
52
47
|
initialHTML: string | null;
|
|
53
48
|
isCommitting: boolean;
|
|
54
49
|
beginEditingAt: number;
|
|
55
|
-
activeMarks:
|
|
50
|
+
activeMarks: SelectModeTiptapActiveMarks;
|
|
56
51
|
actions: {
|
|
57
52
|
reset: () => void;
|
|
58
53
|
setDisplayMode: (displayMode: DisplayMode) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { createShallowStore
|
|
2
|
+
import { createShallowStore } from "../_vendor/replo-utils/react/zustand.mjs";
|
|
3
3
|
import {
|
|
4
4
|
buildElementDescriptor,
|
|
5
5
|
buildSelector
|
|
@@ -12,16 +12,14 @@ import {
|
|
|
12
12
|
import { reportInlineEditFeedback } from "./inlineEditFeedback";
|
|
13
13
|
import { getDocumentScrollOffset } from "./interactions/selectionGeometry";
|
|
14
14
|
import { isTextEditableElement } from "./isTextEditableElement";
|
|
15
|
-
import {
|
|
16
|
-
getAreaSelectionFrameSpecs,
|
|
17
|
-
getElementSelectionFrameSpecs
|
|
18
|
-
} from "./selectionFrame";
|
|
15
|
+
import { getSelectionFrameSpecs } from "./selectionFrame";
|
|
19
16
|
import { getConnectedSelectedElement, IDLE_SESSION } from "./selectModeSession";
|
|
20
17
|
import {
|
|
21
18
|
isUserSourceLocation,
|
|
22
19
|
symbolicateSelectedElement
|
|
23
20
|
} from "./symbolicate";
|
|
24
21
|
import { createInlineTiptapEditor } from "./tiptapInlineEditor";
|
|
22
|
+
import { useShallowStore } from "./useShallowStore";
|
|
25
23
|
const EMPTY_ACTIVE_MARKS = {
|
|
26
24
|
bold: false,
|
|
27
25
|
italic: false,
|
|
@@ -404,17 +402,19 @@ const selectModeStore = createShallowStore(
|
|
|
404
402
|
},
|
|
405
403
|
showElementSelectionFrames: ({ elements, scrollOffset }) => {
|
|
406
404
|
set({
|
|
407
|
-
selectionFrames:
|
|
405
|
+
selectionFrames: getSelectionFrameSpecs({
|
|
408
406
|
elements,
|
|
409
|
-
scrollOffset
|
|
407
|
+
scrollOffset,
|
|
408
|
+
variant: "element"
|
|
410
409
|
})
|
|
411
410
|
});
|
|
412
411
|
},
|
|
413
412
|
showAreaSelectionFrames: ({ elements, scrollOffset }) => {
|
|
414
413
|
set({
|
|
415
|
-
selectionFrames:
|
|
414
|
+
selectionFrames: getSelectionFrameSpecs({
|
|
416
415
|
elements,
|
|
417
|
-
scrollOffset
|
|
416
|
+
scrollOffset,
|
|
417
|
+
variant: "area"
|
|
418
418
|
})
|
|
419
419
|
});
|
|
420
420
|
},
|
|
@@ -12,17 +12,11 @@ export type SelectionFrameSpec = {
|
|
|
12
12
|
pageRect: SelectionFramePageRect;
|
|
13
13
|
variant: SelectionFrameVariant;
|
|
14
14
|
};
|
|
15
|
-
export declare function
|
|
16
|
-
elements: Element[];
|
|
17
|
-
scrollOffset: {
|
|
18
|
-
left: number;
|
|
19
|
-
top: number;
|
|
20
|
-
};
|
|
21
|
-
}): SelectionFrameSpec[];
|
|
22
|
-
export declare function getAreaSelectionFrameSpecs({ elements, scrollOffset, }: {
|
|
15
|
+
export declare function getSelectionFrameSpecs({ elements, scrollOffset, variant, }: {
|
|
23
16
|
elements: Element[];
|
|
24
17
|
scrollOffset: {
|
|
25
18
|
left: number;
|
|
26
19
|
top: number;
|
|
27
20
|
};
|
|
21
|
+
variant: SelectionFrameVariant;
|
|
28
22
|
}): SelectionFrameSpec[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const SELECTION_FRAMES_CONTAINER_ID = "replo-select-mode-selection-frames";
|
|
2
2
|
const SELECTION_FRAME_BORDER_HEX = "#c026d3";
|
|
3
3
|
const SELECTION_FRAME_EDITING_BORDER_HEX = "#e879f9";
|
|
4
|
-
function
|
|
4
|
+
function getSelectionFrameSpecs({
|
|
5
5
|
elements,
|
|
6
6
|
scrollOffset,
|
|
7
7
|
variant
|
|
@@ -19,22 +19,9 @@ function getFrameSpecs({
|
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
function getElementSelectionFrameSpecs({
|
|
23
|
-
elements,
|
|
24
|
-
scrollOffset
|
|
25
|
-
}) {
|
|
26
|
-
return getFrameSpecs({ elements, scrollOffset, variant: "element" });
|
|
27
|
-
}
|
|
28
|
-
function getAreaSelectionFrameSpecs({
|
|
29
|
-
elements,
|
|
30
|
-
scrollOffset
|
|
31
|
-
}) {
|
|
32
|
-
return getFrameSpecs({ elements, scrollOffset, variant: "area" });
|
|
33
|
-
}
|
|
34
22
|
export {
|
|
35
23
|
SELECTION_FRAMES_CONTAINER_ID,
|
|
36
24
|
SELECTION_FRAME_BORDER_HEX,
|
|
37
25
|
SELECTION_FRAME_EDITING_BORDER_HEX,
|
|
38
|
-
|
|
39
|
-
getElementSelectionFrameSpecs
|
|
26
|
+
getSelectionFrameSpecs
|
|
40
27
|
};
|