@replohq/sandbox-runtime 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ClientErrorBoundary.d.ts +10 -0
- package/ClientErrorBoundary.js +61 -0
- package/ClientErrorBoundary.js.map +7 -0
- package/DocumentReadyBeacon.d.ts +1 -0
- package/DocumentReadyBeacon.js +9 -0
- package/DocumentReadyBeacon.js.map +7 -0
- package/LICENSE +11 -0
- package/LinkInterceptor.d.ts +1 -0
- package/LinkInterceptor.js +128 -0
- package/LinkInterceptor.js.map +7 -0
- package/NextErrorReporter.d.ts +1 -0
- package/NextErrorReporter.js +92 -0
- package/NextErrorReporter.js.map +7 -0
- package/_vendor/replo-utils/lib/crypto.d.ts +30 -0
- package/_vendor/replo-utils/lib/errors.d.ts +83 -0
- package/_vendor/replo-utils/lib/fonts.d.ts +49 -0
- package/_vendor/replo-utils/lib/fonts.mjs +221 -0
- package/_vendor/replo-utils/lib/geometry.d.ts +18 -0
- package/_vendor/replo-utils/lib/geometry.mjs +9 -0
- package/_vendor/replo-utils/lib/json.d.ts +6 -0
- package/_vendor/replo-utils/lib/log.d.ts +11 -0
- package/_vendor/replo-utils/lib/misc.d.ts +145 -0
- package/_vendor/replo-utils/lib/misc.mjs +2 -0
- package/_vendor/replo-utils/lib/object.d.ts +31 -0
- package/_vendor/replo-utils/lib/parse.d.ts +15 -0
- package/_vendor/replo-utils/lib/posthogReplay.d.ts +43 -0
- package/_vendor/replo-utils/lib/posthogReplay.mjs +121 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.d.ts +14 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +14 -0
- package/_vendor/schemas/designLibrary.d.ts +361 -0
- package/_vendor/schemas/designLibrary.mjs +126 -0
- package/_vendor/schemas/errors.d.ts +459 -0
- package/_vendor/schemas/generated/errors.d.ts +61 -0
- package/_vendor/schemas/generated/pageAnnotations.d.ts +48 -0
- package/_vendor/schemas/generated/pageAnnotations.mjs +1 -0
- package/_vendor/schemas/generated/selectMode.d.ts +119 -0
- package/_vendor/schemas/generated/selectMode.mjs +1 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +100 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.mjs +1 -0
- package/_vendor/schemas/iframeRpcChannel.d.ts +82 -0
- package/_vendor/schemas/iframeRpcChannel.mjs +520 -0
- package/_vendor/schemas/pageAnnotations.d.ts +134 -0
- package/_vendor/schemas/pageAnnotations.mjs +61 -0
- package/_vendor/schemas/savedStyles.d.ts +140 -0
- package/_vendor/schemas/selectMode.d.ts +522 -0
- package/_vendor/schemas/selectMode.mjs +3 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +900 -0
- package/_vendor/schemas/selectModeIframeRpc.mjs +223 -0
- package/annotations/AnnotationLayerMount.d.ts +1 -0
- package/annotations/AnnotationLayerMount.js +13 -0
- package/annotations/AnnotationLayerMount.js.map +7 -0
- package/annotations/annotationController.d.ts +1 -0
- package/annotations/annotationController.js +384 -0
- package/annotations/annotationController.js.map +7 -0
- package/annotations/bridgeGate.d.ts +7 -0
- package/annotations/bridgeGate.js +22 -0
- package/annotations/bridgeGate.js.map +7 -0
- package/chunk-3UFG7XTQ.mjs +205 -0
- package/chunk-FNTGY7I5.mjs +68 -0
- package/chunk-N5EI2MOZ.mjs +1535 -0
- package/design-library-preview/DesignLibraryPreview.d.ts +1 -0
- package/design-library-preview/DesignLibraryPreview.js +93 -0
- package/design-library-preview/DesignLibraryPreview.js.map +7 -0
- package/package.json +41 -0
- package/posthog-relay.d.ts +11 -0
- package/posthog-relay.js +72 -0
- package/posthog-relay.js.map +7 -0
- package/sandbox-runtime.d.ts +1 -0
- package/sandbox-runtime.js +29 -0
- package/sandbox-runtime.js.map +7 -0
- package/select-mode/EditorSelection.d.ts +24 -0
- package/select-mode/EditorSelection.js +95 -0
- package/select-mode/EditorSelection.js.map +7 -0
- package/select-mode/annotationFrames.d.ts +33 -0
- package/select-mode/annotationFrames.js +119 -0
- package/select-mode/annotationFrames.js.map +7 -0
- package/select-mode/descriptor/elementDescriptor.d.ts +26 -0
- package/select-mode/descriptor/elementDescriptor.js +201 -0
- package/select-mode/descriptor/elementDescriptor.js.map +7 -0
- package/select-mode/descriptor/styleExtraction.d.ts +3 -0
- package/select-mode/descriptor/styleExtraction.js +271 -0
- package/select-mode/descriptor/styleExtraction.js.map +7 -0
- package/select-mode/displayModeStore.d.ts +10 -0
- package/select-mode/displayModeStore.js +47 -0
- package/select-mode/displayModeStore.js.map +7 -0
- package/select-mode/fast-refresh-relay.d.ts +3 -0
- package/select-mode/fast-refresh-relay.js +33 -0
- package/select-mode/fast-refresh-relay.js.map +7 -0
- package/select-mode/fiber.d.ts +49 -0
- package/select-mode/fiber.js +306 -0
- package/select-mode/fiber.js.map +7 -0
- package/select-mode/hooks/useCrosshairCursor.d.ts +12 -0
- package/select-mode/hooks/useCrosshairCursor.js +20 -0
- package/select-mode/hooks/useCrosshairCursor.js.map +7 -0
- package/select-mode/hooks/useEditModeStateMachine.d.ts +16 -0
- package/select-mode/hooks/useEditModeStateMachine.js +235 -0
- package/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
- package/select-mode/hooks/useOptimisticOverrides.d.ts +17 -0
- package/select-mode/hooks/useOptimisticOverrides.js +283 -0
- package/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
- package/select-mode/hooks/useParentMessaging.d.ts +36 -0
- package/select-mode/hooks/useParentMessaging.js +74 -0
- package/select-mode/hooks/useParentMessaging.js.map +7 -0
- package/select-mode/hooks/useSelectModeController.d.ts +8 -0
- package/select-mode/hooks/useSelectModeController.js +46 -0
- package/select-mode/hooks/useSelectModeController.js.map +7 -0
- package/select-mode/hooks/useSelectionHover.d.ts +22 -0
- package/select-mode/hooks/useSelectionHover.js +110 -0
- package/select-mode/hooks/useSelectionHover.js.map +7 -0
- package/select-mode/hooks/useSelectionInteractions.d.ts +37 -0
- package/select-mode/hooks/useSelectionInteractions.js +353 -0
- package/select-mode/hooks/useSelectionInteractions.js.map +7 -0
- package/select-mode/hooks/useSelectionScrollSync.d.ts +28 -0
- package/select-mode/hooks/useSelectionScrollSync.js +70 -0
- package/select-mode/hooks/useSelectionScrollSync.js.map +7 -0
- package/select-mode/hooks/useSiblingResolution.d.ts +6 -0
- package/select-mode/hooks/useSiblingResolution.js +59 -0
- package/select-mode/hooks/useSiblingResolution.js.map +7 -0
- package/select-mode/iframeRpcChannel.d.ts +356 -0
- package/select-mode/iframeRpcChannel.js +92 -0
- package/select-mode/iframeRpcChannel.js.map +7 -0
- package/select-mode/inlineTextMarks.d.ts +6 -0
- package/select-mode/inlineTextMarks.js +25 -0
- package/select-mode/inlineTextMarks.js.map +7 -0
- package/select-mode/interactions/selectionGeometry.d.ts +105 -0
- package/select-mode/interactions/selectionGeometry.js +192 -0
- package/select-mode/interactions/selectionGeometry.js.map +7 -0
- package/select-mode/selectModeSession.d.ts +21 -0
- package/select-mode/selectModeSession.js +7 -0
- package/select-mode/selectModeSession.js.map +7 -0
- package/select-mode/selectionFrame.d.ts +81 -0
- package/select-mode/selectionFrame.js +132 -0
- package/select-mode/selectionFrame.js.map +7 -0
- package/select-mode/symbolicate.d.ts +2 -0
- package/select-mode/symbolicate.js +200 -0
- package/select-mode/symbolicate.js.map +7 -0
- package/select-mode/tiptapInlineEditor.d.ts +23 -0
- package/select-mode/tiptapInlineEditor.js +120 -0
- package/select-mode/tiptapInlineEditor.js.map +7 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import type { SelectedElement } from "../_vendor/schemas/generated/selectMode";
|
|
2
|
+
import type { IframeRpcChannelInputHandlers, IframeRpcChannelRemote } from "../_vendor/schemas/iframeRpcChannel";
|
|
3
|
+
import { canopyToWebsiteBuilderMethodConfig, websiteBuilderToCanopyMethodConfig } from "../_vendor/schemas/selectModeIframeRpc";
|
|
4
|
+
export type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<typeof canopyToWebsiteBuilderMethodConfig>;
|
|
5
|
+
type SelectModeParentMessagingHandlers = Omit<IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>, "symbolicateSelectedElement">;
|
|
6
|
+
export declare function getSelectModeIframeRpcChannel(): import("../_vendor/schemas/iframeRpcChannel").IframeRpcChannel<{
|
|
7
|
+
requestInlineTextEdit: {
|
|
8
|
+
inputSchema: import("zod").ZodObject<{
|
|
9
|
+
editId: import("zod").ZodString;
|
|
10
|
+
element: import("zod").ZodObject<{
|
|
11
|
+
kind: import("zod").ZodLiteral<"react-element">;
|
|
12
|
+
selector: import("zod").ZodString;
|
|
13
|
+
tagName: import("zod").ZodString;
|
|
14
|
+
elementType: import("zod").ZodString;
|
|
15
|
+
textContent: import("zod").ZodNullable<import("zod").ZodString>;
|
|
16
|
+
rect: import("zod").ZodObject<{
|
|
17
|
+
x: import("zod").ZodNumber;
|
|
18
|
+
y: import("zod").ZodNumber;
|
|
19
|
+
left: import("zod").ZodNumber;
|
|
20
|
+
top: import("zod").ZodNumber;
|
|
21
|
+
right: import("zod").ZodNumber;
|
|
22
|
+
bottom: import("zod").ZodNumber;
|
|
23
|
+
width: import("zod").ZodNumber;
|
|
24
|
+
height: import("zod").ZodNumber;
|
|
25
|
+
}, import("zod/v4/core").$strip>;
|
|
26
|
+
textMetrics: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
27
|
+
tightWidth: import("zod").ZodNumber;
|
|
28
|
+
lineCount: import("zod").ZodNumber;
|
|
29
|
+
lineHeight: import("zod").ZodNumber;
|
|
30
|
+
}, import("zod/v4/core").$strip>>;
|
|
31
|
+
outerHTML: import("zod").ZodString;
|
|
32
|
+
definedStyles: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
33
|
+
property: import("zod").ZodString;
|
|
34
|
+
variant: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
35
|
+
atRules: import("zod").ZodArray<import("zod").ZodObject<{
|
|
36
|
+
type: import("zod").ZodString;
|
|
37
|
+
text: import("zod").ZodString;
|
|
38
|
+
}, import("zod/v4/core").$strip>>;
|
|
39
|
+
pseudo: import("zod").ZodNullable<import("zod").ZodString>;
|
|
40
|
+
}, import("zod/v4/core").$strip>>;
|
|
41
|
+
className: import("zod").ZodNullable<import("zod").ZodString>;
|
|
42
|
+
raw: import("zod").ZodString;
|
|
43
|
+
resolved: import("zod").ZodString;
|
|
44
|
+
}, import("zod/v4/core").$strip>>>;
|
|
45
|
+
inheritedStyles: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
46
|
+
clickPosition: import("zod").ZodObject<{
|
|
47
|
+
x: import("zod").ZodNumber;
|
|
48
|
+
y: import("zod").ZodNumber;
|
|
49
|
+
}, import("zod/v4/core").$strip>;
|
|
50
|
+
sourceLocation: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
51
|
+
filePath: import("zod").ZodString;
|
|
52
|
+
lineNumber: import("zod").ZodNumber;
|
|
53
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
54
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
55
|
+
}, import("zod/v4/core").$strip>>;
|
|
56
|
+
fiberChain: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
57
|
+
sourceLocation: import("zod").ZodObject<{
|
|
58
|
+
filePath: import("zod").ZodString;
|
|
59
|
+
lineNumber: import("zod").ZodNumber;
|
|
60
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
61
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
}, import("zod/v4/core").$strip>;
|
|
63
|
+
tagName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
64
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
65
|
+
props: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
66
|
+
}, import("zod/v4/core").$strip>>>;
|
|
67
|
+
siblingSelectors: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
68
|
+
}, import("zod/v4/core").$strip>;
|
|
69
|
+
}, import("zod/v4/core").$strip>;
|
|
70
|
+
outputSchema: import("zod").ZodObject<{
|
|
71
|
+
allowed: import("zod").ZodBoolean;
|
|
72
|
+
}, import("zod/v4/core").$strip>;
|
|
73
|
+
timeoutMs: number;
|
|
74
|
+
};
|
|
75
|
+
iframeReady: {
|
|
76
|
+
inputSchema: import("zod").ZodUndefined;
|
|
77
|
+
outputSchema: import("zod").ZodVoid;
|
|
78
|
+
};
|
|
79
|
+
elementSelected: {
|
|
80
|
+
inputSchema: import("zod").ZodObject<{
|
|
81
|
+
data: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
82
|
+
kind: import("zod").ZodLiteral<"react-element">;
|
|
83
|
+
selector: import("zod").ZodString;
|
|
84
|
+
tagName: import("zod").ZodString;
|
|
85
|
+
elementType: import("zod").ZodString;
|
|
86
|
+
textContent: import("zod").ZodNullable<import("zod").ZodString>;
|
|
87
|
+
rect: import("zod").ZodObject<{
|
|
88
|
+
x: import("zod").ZodNumber;
|
|
89
|
+
y: import("zod").ZodNumber;
|
|
90
|
+
left: import("zod").ZodNumber;
|
|
91
|
+
top: import("zod").ZodNumber;
|
|
92
|
+
right: import("zod").ZodNumber;
|
|
93
|
+
bottom: import("zod").ZodNumber;
|
|
94
|
+
width: import("zod").ZodNumber;
|
|
95
|
+
height: import("zod").ZodNumber;
|
|
96
|
+
}, import("zod/v4/core").$strip>;
|
|
97
|
+
textMetrics: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
98
|
+
tightWidth: import("zod").ZodNumber;
|
|
99
|
+
lineCount: import("zod").ZodNumber;
|
|
100
|
+
lineHeight: import("zod").ZodNumber;
|
|
101
|
+
}, import("zod/v4/core").$strip>>;
|
|
102
|
+
outerHTML: import("zod").ZodString;
|
|
103
|
+
definedStyles: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
104
|
+
property: import("zod").ZodString;
|
|
105
|
+
variant: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
106
|
+
atRules: import("zod").ZodArray<import("zod").ZodObject<{
|
|
107
|
+
type: import("zod").ZodString;
|
|
108
|
+
text: import("zod").ZodString;
|
|
109
|
+
}, import("zod/v4/core").$strip>>;
|
|
110
|
+
pseudo: import("zod").ZodNullable<import("zod").ZodString>;
|
|
111
|
+
}, import("zod/v4/core").$strip>>;
|
|
112
|
+
className: import("zod").ZodNullable<import("zod").ZodString>;
|
|
113
|
+
raw: import("zod").ZodString;
|
|
114
|
+
resolved: import("zod").ZodString;
|
|
115
|
+
}, import("zod/v4/core").$strip>>>;
|
|
116
|
+
inheritedStyles: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
117
|
+
clickPosition: import("zod").ZodObject<{
|
|
118
|
+
x: import("zod").ZodNumber;
|
|
119
|
+
y: import("zod").ZodNumber;
|
|
120
|
+
}, import("zod/v4/core").$strip>;
|
|
121
|
+
sourceLocation: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
122
|
+
filePath: import("zod").ZodString;
|
|
123
|
+
lineNumber: import("zod").ZodNumber;
|
|
124
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
125
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
126
|
+
}, import("zod/v4/core").$strip>>;
|
|
127
|
+
fiberChain: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
128
|
+
sourceLocation: import("zod").ZodObject<{
|
|
129
|
+
filePath: import("zod").ZodString;
|
|
130
|
+
lineNumber: import("zod").ZodNumber;
|
|
131
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
132
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
133
|
+
}, import("zod/v4/core").$strip>;
|
|
134
|
+
tagName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
135
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
136
|
+
props: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
137
|
+
}, import("zod/v4/core").$strip>>>;
|
|
138
|
+
siblingSelectors: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
139
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
140
|
+
kind: import("zod").ZodLiteral<"plan">;
|
|
141
|
+
planId: import("zod").ZodString;
|
|
142
|
+
label: import("zod").ZodString;
|
|
143
|
+
rect: import("zod").ZodObject<{
|
|
144
|
+
x: import("zod").ZodNumber;
|
|
145
|
+
y: import("zod").ZodNumber;
|
|
146
|
+
left: import("zod").ZodNumber;
|
|
147
|
+
top: import("zod").ZodNumber;
|
|
148
|
+
right: import("zod").ZodNumber;
|
|
149
|
+
bottom: import("zod").ZodNumber;
|
|
150
|
+
width: import("zod").ZodNumber;
|
|
151
|
+
height: import("zod").ZodNumber;
|
|
152
|
+
}, import("zod/v4/core").$strip>;
|
|
153
|
+
}, import("zod/v4/core").$strip>], "kind">;
|
|
154
|
+
}, import("zod/v4/core").$strip>;
|
|
155
|
+
outputSchema: import("zod").ZodVoid;
|
|
156
|
+
};
|
|
157
|
+
hoverElement: {
|
|
158
|
+
inputSchema: import("zod").ZodObject<{
|
|
159
|
+
rect: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
160
|
+
x: import("zod").ZodNumber;
|
|
161
|
+
y: import("zod").ZodNumber;
|
|
162
|
+
left: import("zod").ZodNumber;
|
|
163
|
+
top: import("zod").ZodNumber;
|
|
164
|
+
right: import("zod").ZodNumber;
|
|
165
|
+
bottom: import("zod").ZodNumber;
|
|
166
|
+
width: import("zod").ZodNumber;
|
|
167
|
+
height: import("zod").ZodNumber;
|
|
168
|
+
}, import("zod/v4/core").$strip>>;
|
|
169
|
+
}, import("zod/v4/core").$strip>;
|
|
170
|
+
outputSchema: import("zod").ZodVoid;
|
|
171
|
+
};
|
|
172
|
+
selectedElementRectUpdate: {
|
|
173
|
+
inputSchema: import("zod").ZodObject<{
|
|
174
|
+
rect: import("zod").ZodObject<{
|
|
175
|
+
x: import("zod").ZodNumber;
|
|
176
|
+
y: import("zod").ZodNumber;
|
|
177
|
+
left: import("zod").ZodNumber;
|
|
178
|
+
top: import("zod").ZodNumber;
|
|
179
|
+
right: import("zod").ZodNumber;
|
|
180
|
+
bottom: import("zod").ZodNumber;
|
|
181
|
+
width: import("zod").ZodNumber;
|
|
182
|
+
height: import("zod").ZodNumber;
|
|
183
|
+
}, import("zod/v4/core").$strip>;
|
|
184
|
+
clickPosition: import("zod").ZodObject<{
|
|
185
|
+
x: import("zod").ZodNumber;
|
|
186
|
+
y: import("zod").ZodNumber;
|
|
187
|
+
}, import("zod/v4/core").$strip>;
|
|
188
|
+
}, import("zod/v4/core").$strip>;
|
|
189
|
+
outputSchema: import("zod").ZodVoid;
|
|
190
|
+
};
|
|
191
|
+
selectedAreaRectUpdate: {
|
|
192
|
+
inputSchema: import("zod").ZodObject<{
|
|
193
|
+
rect: import("zod").ZodObject<{
|
|
194
|
+
x: import("zod").ZodNumber;
|
|
195
|
+
y: import("zod").ZodNumber;
|
|
196
|
+
left: import("zod").ZodNumber;
|
|
197
|
+
top: import("zod").ZodNumber;
|
|
198
|
+
right: import("zod").ZodNumber;
|
|
199
|
+
bottom: import("zod").ZodNumber;
|
|
200
|
+
width: import("zod").ZodNumber;
|
|
201
|
+
height: import("zod").ZodNumber;
|
|
202
|
+
}, import("zod/v4/core").$strip>;
|
|
203
|
+
}, import("zod/v4/core").$strip>;
|
|
204
|
+
outputSchema: import("zod").ZodVoid;
|
|
205
|
+
};
|
|
206
|
+
dragRectUpdated: {
|
|
207
|
+
inputSchema: import("zod").ZodObject<{
|
|
208
|
+
dragRect: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
209
|
+
x: import("zod").ZodNumber;
|
|
210
|
+
y: import("zod").ZodNumber;
|
|
211
|
+
left: import("zod").ZodNumber;
|
|
212
|
+
top: import("zod").ZodNumber;
|
|
213
|
+
right: import("zod").ZodNumber;
|
|
214
|
+
bottom: import("zod").ZodNumber;
|
|
215
|
+
width: import("zod").ZodNumber;
|
|
216
|
+
height: import("zod").ZodNumber;
|
|
217
|
+
}, import("zod/v4/core").$strip>>;
|
|
218
|
+
selectionRects: import("zod").ZodArray<import("zod").ZodObject<{
|
|
219
|
+
id: import("zod").ZodString;
|
|
220
|
+
rect: import("zod").ZodObject<{
|
|
221
|
+
x: import("zod").ZodNumber;
|
|
222
|
+
y: import("zod").ZodNumber;
|
|
223
|
+
left: import("zod").ZodNumber;
|
|
224
|
+
top: import("zod").ZodNumber;
|
|
225
|
+
right: import("zod").ZodNumber;
|
|
226
|
+
bottom: import("zod").ZodNumber;
|
|
227
|
+
width: import("zod").ZodNumber;
|
|
228
|
+
height: import("zod").ZodNumber;
|
|
229
|
+
}, import("zod/v4/core").$strip>;
|
|
230
|
+
}, import("zod/v4/core").$strip>>;
|
|
231
|
+
}, import("zod/v4/core").$strip>;
|
|
232
|
+
outputSchema: import("zod").ZodVoid;
|
|
233
|
+
};
|
|
234
|
+
areaSelected: {
|
|
235
|
+
inputSchema: import("zod").ZodObject<{
|
|
236
|
+
rect: import("zod").ZodObject<{
|
|
237
|
+
x: import("zod").ZodNumber;
|
|
238
|
+
y: import("zod").ZodNumber;
|
|
239
|
+
left: import("zod").ZodNumber;
|
|
240
|
+
top: import("zod").ZodNumber;
|
|
241
|
+
right: import("zod").ZodNumber;
|
|
242
|
+
bottom: import("zod").ZodNumber;
|
|
243
|
+
width: import("zod").ZodNumber;
|
|
244
|
+
height: import("zod").ZodNumber;
|
|
245
|
+
}, import("zod/v4/core").$strip>;
|
|
246
|
+
items: import("zod").ZodArray<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
|
|
247
|
+
kind: import("zod").ZodLiteral<"react-element">;
|
|
248
|
+
selector: import("zod").ZodString;
|
|
249
|
+
tagName: import("zod").ZodString;
|
|
250
|
+
elementType: import("zod").ZodString;
|
|
251
|
+
textContent: import("zod").ZodNullable<import("zod").ZodString>;
|
|
252
|
+
rect: import("zod").ZodObject<{
|
|
253
|
+
x: import("zod").ZodNumber;
|
|
254
|
+
y: import("zod").ZodNumber;
|
|
255
|
+
left: import("zod").ZodNumber;
|
|
256
|
+
top: import("zod").ZodNumber;
|
|
257
|
+
right: import("zod").ZodNumber;
|
|
258
|
+
bottom: import("zod").ZodNumber;
|
|
259
|
+
width: import("zod").ZodNumber;
|
|
260
|
+
height: import("zod").ZodNumber;
|
|
261
|
+
}, import("zod/v4/core").$strip>;
|
|
262
|
+
textMetrics: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
263
|
+
tightWidth: import("zod").ZodNumber;
|
|
264
|
+
lineCount: import("zod").ZodNumber;
|
|
265
|
+
lineHeight: import("zod").ZodNumber;
|
|
266
|
+
}, import("zod/v4/core").$strip>>;
|
|
267
|
+
outerHTML: import("zod").ZodString;
|
|
268
|
+
definedStyles: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
269
|
+
property: import("zod").ZodString;
|
|
270
|
+
variant: import("zod").ZodNullable<import("zod").ZodObject<{
|
|
271
|
+
atRules: import("zod").ZodArray<import("zod").ZodObject<{
|
|
272
|
+
type: import("zod").ZodString;
|
|
273
|
+
text: import("zod").ZodString;
|
|
274
|
+
}, import("zod/v4/core").$strip>>;
|
|
275
|
+
pseudo: import("zod").ZodNullable<import("zod").ZodString>;
|
|
276
|
+
}, import("zod/v4/core").$strip>>;
|
|
277
|
+
className: import("zod").ZodNullable<import("zod").ZodString>;
|
|
278
|
+
raw: import("zod").ZodString;
|
|
279
|
+
resolved: import("zod").ZodString;
|
|
280
|
+
}, import("zod/v4/core").$strip>>>;
|
|
281
|
+
inheritedStyles: import("zod").ZodDefault<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
282
|
+
clickPosition: import("zod").ZodObject<{
|
|
283
|
+
x: import("zod").ZodNumber;
|
|
284
|
+
y: import("zod").ZodNumber;
|
|
285
|
+
}, import("zod/v4/core").$strip>;
|
|
286
|
+
sourceLocation: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
287
|
+
filePath: import("zod").ZodString;
|
|
288
|
+
lineNumber: import("zod").ZodNumber;
|
|
289
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
290
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
291
|
+
}, import("zod/v4/core").$strip>>;
|
|
292
|
+
fiberChain: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodObject<{
|
|
293
|
+
sourceLocation: import("zod").ZodObject<{
|
|
294
|
+
filePath: import("zod").ZodString;
|
|
295
|
+
lineNumber: import("zod").ZodNumber;
|
|
296
|
+
columnNumber: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
297
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
298
|
+
}, import("zod/v4/core").$strip>;
|
|
299
|
+
tagName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
300
|
+
componentName: import("zod").ZodOptional<import("zod").ZodString>;
|
|
301
|
+
props: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
|
|
302
|
+
}, import("zod/v4/core").$strip>>>;
|
|
303
|
+
siblingSelectors: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
304
|
+
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
305
|
+
kind: import("zod").ZodLiteral<"plan">;
|
|
306
|
+
planId: import("zod").ZodString;
|
|
307
|
+
label: import("zod").ZodString;
|
|
308
|
+
rect: import("zod").ZodObject<{
|
|
309
|
+
x: import("zod").ZodNumber;
|
|
310
|
+
y: import("zod").ZodNumber;
|
|
311
|
+
left: import("zod").ZodNumber;
|
|
312
|
+
top: import("zod").ZodNumber;
|
|
313
|
+
right: import("zod").ZodNumber;
|
|
314
|
+
bottom: import("zod").ZodNumber;
|
|
315
|
+
width: import("zod").ZodNumber;
|
|
316
|
+
height: import("zod").ZodNumber;
|
|
317
|
+
}, import("zod/v4/core").$strip>;
|
|
318
|
+
}, import("zod/v4/core").$strip>], "kind">>;
|
|
319
|
+
}, import("zod/v4/core").$strip>;
|
|
320
|
+
outputSchema: import("zod").ZodVoid;
|
|
321
|
+
};
|
|
322
|
+
textCommitted: {
|
|
323
|
+
inputSchema: import("zod").ZodObject<{
|
|
324
|
+
editId: import("zod").ZodString;
|
|
325
|
+
html: import("zod").ZodString;
|
|
326
|
+
json: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
|
|
327
|
+
originalInnerHTML: import("zod").ZodString;
|
|
328
|
+
}, import("zod/v4/core").$strip>;
|
|
329
|
+
outputSchema: import("zod").ZodVoid;
|
|
330
|
+
};
|
|
331
|
+
editorStateUpdate: {
|
|
332
|
+
inputSchema: import("zod").ZodObject<{
|
|
333
|
+
activeMarks: import("zod").ZodObject<{
|
|
334
|
+
bold: import("zod").ZodBoolean;
|
|
335
|
+
italic: import("zod").ZodBoolean;
|
|
336
|
+
underline: import("zod").ZodBoolean;
|
|
337
|
+
strike: import("zod").ZodBoolean;
|
|
338
|
+
}, import("zod/v4/core").$strip>;
|
|
339
|
+
isEditing: import("zod").ZodBoolean;
|
|
340
|
+
}, import("zod/v4/core").$strip>;
|
|
341
|
+
outputSchema: import("zod").ZodVoid;
|
|
342
|
+
};
|
|
343
|
+
fastRefreshComplete: {
|
|
344
|
+
inputSchema: import("zod").ZodUndefined;
|
|
345
|
+
outputSchema: import("zod").ZodVoid;
|
|
346
|
+
};
|
|
347
|
+
}> | null;
|
|
348
|
+
export declare function setSelectModeParentHandlers(nextHandlers: SelectModeParentMessagingHandlers | null): void;
|
|
349
|
+
export declare function getWebsiteBuilderRpc(): WebsiteBuilderRpcRemote | null;
|
|
350
|
+
export declare function requestInlineTextEdit(input: {
|
|
351
|
+
editId: string;
|
|
352
|
+
element: SelectedElement;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
allowed: boolean;
|
|
355
|
+
}>;
|
|
356
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createIframeRpcChannel,
|
|
3
|
+
createIframeRpcRemote
|
|
4
|
+
} from "../_vendor/schemas/iframeRpcChannel.mjs";
|
|
5
|
+
import {
|
|
6
|
+
canopyToWebsiteBuilderMethodConfig,
|
|
7
|
+
SELECT_MODE_IFRAME_RPC_CHANNEL_ID,
|
|
8
|
+
SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,
|
|
9
|
+
websiteBuilderToCanopyMethodConfig
|
|
10
|
+
} from "../_vendor/schemas/selectModeIframeRpc.mjs";
|
|
11
|
+
import { symbolicateSelectedElement } from "./symbolicate";
|
|
12
|
+
let messagingHandlers = null;
|
|
13
|
+
function createSelectModeIframeRpcChannel() {
|
|
14
|
+
return createIframeRpcChannel({
|
|
15
|
+
subscriberWindow: window,
|
|
16
|
+
channelIdentifier: SELECT_MODE_IFRAME_RPC_CHANNEL_ID,
|
|
17
|
+
version: SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,
|
|
18
|
+
getTargetWindow: () => window.parent === window ? null : window.parent,
|
|
19
|
+
targetOrigin: "*",
|
|
20
|
+
isExpectedMessage: (event) => event.source === window.parent,
|
|
21
|
+
outgoingMethods: canopyToWebsiteBuilderMethodConfig,
|
|
22
|
+
incomingMethods: websiteBuilderToCanopyMethodConfig,
|
|
23
|
+
handlers: {
|
|
24
|
+
setDisplayMode: (input) => {
|
|
25
|
+
messagingHandlers?.setDisplayMode(input);
|
|
26
|
+
},
|
|
27
|
+
setSelectionType: (input) => {
|
|
28
|
+
messagingHandlers?.setSelectionType(input);
|
|
29
|
+
},
|
|
30
|
+
applyOptimisticUpdate: (input) => {
|
|
31
|
+
messagingHandlers?.applyOptimisticUpdate(input);
|
|
32
|
+
},
|
|
33
|
+
markCommitted: (input) => {
|
|
34
|
+
messagingHandlers?.markCommitted(input);
|
|
35
|
+
},
|
|
36
|
+
resolveSessionOverrides: (input) => {
|
|
37
|
+
messagingHandlers?.resolveSessionOverrides(input);
|
|
38
|
+
},
|
|
39
|
+
revertOverride: (input) => {
|
|
40
|
+
messagingHandlers?.revertOverride(input);
|
|
41
|
+
},
|
|
42
|
+
enterEditMode: (input) => {
|
|
43
|
+
messagingHandlers?.enterEditMode(input);
|
|
44
|
+
},
|
|
45
|
+
exitEditMode: (input) => {
|
|
46
|
+
messagingHandlers?.exitEditMode(input);
|
|
47
|
+
},
|
|
48
|
+
formatCommand: (input) => {
|
|
49
|
+
messagingHandlers?.formatCommand(input);
|
|
50
|
+
},
|
|
51
|
+
symbolicateSelectedElement: (element) => {
|
|
52
|
+
return symbolicateSelectedElement(element);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
let channel = null;
|
|
58
|
+
let websiteBuilderRpc = null;
|
|
59
|
+
function getSelectModeIframeRpcChannel() {
|
|
60
|
+
if (typeof window === "undefined") {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
channel ??= createSelectModeIframeRpcChannel();
|
|
64
|
+
return channel;
|
|
65
|
+
}
|
|
66
|
+
function setSelectModeParentHandlers(nextHandlers) {
|
|
67
|
+
messagingHandlers = nextHandlers;
|
|
68
|
+
}
|
|
69
|
+
function getWebsiteBuilderRpc() {
|
|
70
|
+
const currentChannel = getSelectModeIframeRpcChannel();
|
|
71
|
+
if (!currentChannel) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
websiteBuilderRpc ??= createIframeRpcRemote(currentChannel);
|
|
75
|
+
return websiteBuilderRpc;
|
|
76
|
+
}
|
|
77
|
+
function requestInlineTextEdit(input) {
|
|
78
|
+
const remote = getWebsiteBuilderRpc();
|
|
79
|
+
if (!remote) {
|
|
80
|
+
return Promise.reject(
|
|
81
|
+
new Error("Website Builder iframe RPC is unavailable")
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return remote.requestInlineTextEdit(input);
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
getSelectModeIframeRpcChannel,
|
|
88
|
+
getWebsiteBuilderRpc,
|
|
89
|
+
requestInlineTextEdit,
|
|
90
|
+
setSelectModeParentHandlers
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=iframeRpcChannel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../select-mode/iframeRpcChannel.ts"],
|
|
4
|
+
"sourcesContent": ["import type { SelectedElement } from \"schemas/generated/selectMode\";\nimport type {\n IframeRpcChannelInputHandlers,\n IframeRpcChannelRemote,\n} from \"schemas/iframeRpcChannel\";\n\nimport {\n createIframeRpcChannel,\n createIframeRpcRemote,\n} from \"schemas/iframeRpcChannel\";\nimport {\n canopyToWebsiteBuilderMethodConfig,\n SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n websiteBuilderToCanopyMethodConfig,\n} from \"schemas/selectModeIframeRpc\";\n\nimport { symbolicateSelectedElement } from \"./symbolicate\";\n\nexport type WebsiteBuilderRpcRemote = IframeRpcChannelRemote<\n typeof canopyToWebsiteBuilderMethodConfig\n>;\n\ntype SelectModeParentMessagingHandlers = Omit<\n IframeRpcChannelInputHandlers<typeof websiteBuilderToCanopyMethodConfig>,\n \"symbolicateSelectedElement\"\n>;\n\n// Module-level handler pointers; `useParentMessaging` sets these on mount\n// and nulls them on unmount. Inbound void methods are dropped until then.\n// `symbolicateSelectedElement` is wired permanently on the channel.\nlet messagingHandlers: SelectModeParentMessagingHandlers | null = null;\n\nfunction createSelectModeIframeRpcChannel() {\n return createIframeRpcChannel({\n subscriberWindow: window,\n channelIdentifier: SELECT_MODE_IFRAME_RPC_CHANNEL_ID,\n version: SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION,\n getTargetWindow: () => (window.parent === window ? null : window.parent),\n targetOrigin: \"*\",\n isExpectedMessage: (event) => event.source === window.parent,\n outgoingMethods: canopyToWebsiteBuilderMethodConfig,\n incomingMethods: websiteBuilderToCanopyMethodConfig,\n handlers: {\n setDisplayMode: (input) => {\n messagingHandlers?.setDisplayMode(input);\n },\n setSelectionType: (input) => {\n messagingHandlers?.setSelectionType(input);\n },\n applyOptimisticUpdate: (input) => {\n messagingHandlers?.applyOptimisticUpdate(input);\n },\n markCommitted: (input) => {\n messagingHandlers?.markCommitted(input);\n },\n resolveSessionOverrides: (input) => {\n messagingHandlers?.resolveSessionOverrides(input);\n },\n revertOverride: (input) => {\n messagingHandlers?.revertOverride(input);\n },\n enterEditMode: (input) => {\n messagingHandlers?.enterEditMode(input);\n },\n exitEditMode: (input) => {\n messagingHandlers?.exitEditMode(input);\n },\n formatCommand: (input) => {\n messagingHandlers?.formatCommand(input);\n },\n symbolicateSelectedElement: (element) => {\n return symbolicateSelectedElement(element);\n },\n },\n });\n}\n\nlet channel: ReturnType<typeof createSelectModeIframeRpcChannel> | null = null;\nlet websiteBuilderRpc: WebsiteBuilderRpcRemote | null = null;\n\nexport function getSelectModeIframeRpcChannel() {\n if (typeof window === \"undefined\") {\n return null;\n }\n channel ??= createSelectModeIframeRpcChannel();\n return channel;\n}\n\nexport function setSelectModeParentHandlers(\n nextHandlers: SelectModeParentMessagingHandlers | null,\n) {\n messagingHandlers = nextHandlers;\n}\n\nexport function getWebsiteBuilderRpc(): WebsiteBuilderRpcRemote | null {\n const currentChannel = getSelectModeIframeRpcChannel();\n if (!currentChannel) {\n return null;\n }\n websiteBuilderRpc ??= createIframeRpcRemote(currentChannel);\n return websiteBuilderRpc;\n}\n\nexport function requestInlineTextEdit(input: {\n editId: string;\n element: SelectedElement;\n}) {\n const remote = getWebsiteBuilderRpc();\n if (!remote) {\n return Promise.reject(\n new Error(\"Website Builder iframe RPC is unavailable\"),\n );\n }\n return remote.requestInlineTextEdit(input);\n}\n"],
|
|
5
|
+
"mappings": "AAMA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,kCAAkC;AAc3C,IAAI,oBAA8D;AAElE,SAAS,mCAAmC;AAC1C,SAAO,uBAAuB;AAAA,IAC5B,kBAAkB;AAAA,IAClB,mBAAmB;AAAA,IACnB,SAAS;AAAA,IACT,iBAAiB,MAAO,OAAO,WAAW,SAAS,OAAO,OAAO;AAAA,IACjE,cAAc;AAAA,IACd,mBAAmB,CAAC,UAAU,MAAM,WAAW,OAAO;AAAA,IACtD,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,UAAU;AAAA,MACR,gBAAgB,CAAC,UAAU;AACzB,2BAAmB,eAAe,KAAK;AAAA,MACzC;AAAA,MACA,kBAAkB,CAAC,UAAU;AAC3B,2BAAmB,iBAAiB,KAAK;AAAA,MAC3C;AAAA,MACA,uBAAuB,CAAC,UAAU;AAChC,2BAAmB,sBAAsB,KAAK;AAAA,MAChD;AAAA,MACA,eAAe,CAAC,UAAU;AACxB,2BAAmB,cAAc,KAAK;AAAA,MACxC;AAAA,MACA,yBAAyB,CAAC,UAAU;AAClC,2BAAmB,wBAAwB,KAAK;AAAA,MAClD;AAAA,MACA,gBAAgB,CAAC,UAAU;AACzB,2BAAmB,eAAe,KAAK;AAAA,MACzC;AAAA,MACA,eAAe,CAAC,UAAU;AACxB,2BAAmB,cAAc,KAAK;AAAA,MACxC;AAAA,MACA,cAAc,CAAC,UAAU;AACvB,2BAAmB,aAAa,KAAK;AAAA,MACvC;AAAA,MACA,eAAe,CAAC,UAAU;AACxB,2BAAmB,cAAc,KAAK;AAAA,MACxC;AAAA,MACA,4BAA4B,CAAC,YAAY;AACvC,eAAO,2BAA2B,OAAO;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,IAAI,UAAsE;AAC1E,IAAI,oBAAoD;AAEjD,SAAS,gCAAgC;AAC9C,MAAI,OAAO,WAAW,aAAa;AACjC,WAAO;AAAA,EACT;AACA,cAAY,iCAAiC;AAC7C,SAAO;AACT;AAEO,SAAS,4BACd,cACA;AACA,sBAAoB;AACtB;AAEO,SAAS,uBAAuD;AACrE,QAAM,iBAAiB,8BAA8B;AACrD,MAAI,CAAC,gBAAgB;AACnB,WAAO;AAAA,EACT;AACA,wBAAsB,sBAAsB,cAAc;AAC1D,SAAO;AACT;AAEO,SAAS,sBAAsB,OAGnC;AACD,QAAM,SAAS,qBAAqB;AACpC,MAAI,CAAC,QAAQ;AACX,WAAO,QAAQ;AAAA,MACb,IAAI,MAAM,2CAA2C;AAAA,IACvD;AAAA,EACF;AACA,SAAO,OAAO,sBAAsB,KAAK;AAC3C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function isInlineTextMarkElement(element: Element): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Walk up past nested inline text marks so selection targets the host
|
|
4
|
+
* element (e.g. `<p>hello <em>world</em></p>` → the `<p>`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function skipInlineTextMarkElements(element: Element): Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const INLINE_TEXT_MARK_TAGS = /* @__PURE__ */ new Set([
|
|
2
|
+
"b",
|
|
3
|
+
"strong",
|
|
4
|
+
"em",
|
|
5
|
+
"i",
|
|
6
|
+
"s",
|
|
7
|
+
"strike",
|
|
8
|
+
"u",
|
|
9
|
+
"mark"
|
|
10
|
+
]);
|
|
11
|
+
function isInlineTextMarkElement(element) {
|
|
12
|
+
return INLINE_TEXT_MARK_TAGS.has(element.tagName.toLowerCase());
|
|
13
|
+
}
|
|
14
|
+
function skipInlineTextMarkElements(element) {
|
|
15
|
+
let current = element;
|
|
16
|
+
while (isInlineTextMarkElement(current) && current.parentElement && current.parentElement !== document.documentElement && current.parentElement !== document.body) {
|
|
17
|
+
current = current.parentElement;
|
|
18
|
+
}
|
|
19
|
+
return current;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
isInlineTextMarkElement,
|
|
23
|
+
skipInlineTextMarkElements
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=inlineTextMarks.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../select-mode/inlineTextMarks.ts"],
|
|
4
|
+
"sourcesContent": ["// NOTE (Noah, 2026-07-23): TipTap / inline JSX marks are not independently\n// selectable \u2014 clicking bold/italic text should select the host block, not\n// the <strong>/<em> wrapper. Keep in sync with tiptapInlineEditor marks.\nconst INLINE_TEXT_MARK_TAGS = new Set([\n \"b\",\n \"strong\",\n \"em\",\n \"i\",\n \"s\",\n \"strike\",\n \"u\",\n \"mark\",\n]);\n\nexport function isInlineTextMarkElement(element: Element): boolean {\n return INLINE_TEXT_MARK_TAGS.has(element.tagName.toLowerCase());\n}\n\n/**\n * Walk up past nested inline text marks so selection targets the host\n * element (e.g. `<p>hello <em>world</em></p>` \u2192 the `<p>`).\n */\nexport function skipInlineTextMarkElements(element: Element): Element {\n let current = element;\n while (\n isInlineTextMarkElement(current) &&\n current.parentElement &&\n current.parentElement !== document.documentElement &&\n current.parentElement !== document.body\n ) {\n current = current.parentElement;\n }\n return current;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,MAAM,wBAAwB,oBAAI,IAAI;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,wBAAwB,SAA2B;AACjE,SAAO,sBAAsB,IAAI,QAAQ,QAAQ,YAAY,CAAC;AAChE;AAMO,SAAS,2BAA2B,SAA2B;AACpE,MAAI,UAAU;AACd,SACE,wBAAwB,OAAO,KAC/B,QAAQ,iBACR,QAAQ,kBAAkB,SAAS,mBACnC,QAAQ,kBAAkB,SAAS,MACnC;AACA,cAAU,QAAQ;AAAA,EACpB;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { SelectModeBoundingRect, SelectModeClickPosition } from "../../_vendor/schemas/generated/selectMode";
|
|
2
|
+
export type DragPosition = {
|
|
3
|
+
clientX: number;
|
|
4
|
+
clientY: number;
|
|
5
|
+
pageX: number;
|
|
6
|
+
pageY: number;
|
|
7
|
+
};
|
|
8
|
+
export type ScrollOffset = {
|
|
9
|
+
left: number;
|
|
10
|
+
top: number;
|
|
11
|
+
};
|
|
12
|
+
export type SelectedAreaState = {
|
|
13
|
+
pageRect: SelectModeBoundingRect;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @author Kevin O'Connell 2026-04-17
|
|
17
|
+
*/
|
|
18
|
+
export declare function getDragPositionFromClient({ clientX, clientY, scrollOffset, }: {
|
|
19
|
+
clientX: number;
|
|
20
|
+
clientY: number;
|
|
21
|
+
scrollOffset: ScrollOffset;
|
|
22
|
+
}): DragPosition;
|
|
23
|
+
/**
|
|
24
|
+
* @author Kevin O'Connell 2026-04-17
|
|
25
|
+
*/
|
|
26
|
+
export declare function getDocumentScrollOffset(): ScrollOffset;
|
|
27
|
+
/**
|
|
28
|
+
* @author Kevin O'Connell 2026-04-17
|
|
29
|
+
*/
|
|
30
|
+
export declare function getViewportSelectionRect({ dragStart, dragCurrent, scrollOffset, }: {
|
|
31
|
+
dragStart: DragPosition;
|
|
32
|
+
dragCurrent: DragPosition;
|
|
33
|
+
scrollOffset: ScrollOffset;
|
|
34
|
+
}): SelectModeBoundingRect;
|
|
35
|
+
/**
|
|
36
|
+
* @author Kevin O'Connell 2026-04-17
|
|
37
|
+
*/
|
|
38
|
+
export declare function getPageRectFromViewportRect({ rect, scrollOffset, }: {
|
|
39
|
+
rect: SelectModeBoundingRect;
|
|
40
|
+
scrollOffset: ScrollOffset;
|
|
41
|
+
}): SelectModeBoundingRect;
|
|
42
|
+
/**
|
|
43
|
+
* @author Kevin O'Connell 2026-04-17
|
|
44
|
+
*/
|
|
45
|
+
export declare function getViewportRectFromPageRect({ rect, scrollOffset, }: {
|
|
46
|
+
rect: SelectModeBoundingRect;
|
|
47
|
+
scrollOffset: ScrollOffset;
|
|
48
|
+
}): SelectModeBoundingRect;
|
|
49
|
+
/**
|
|
50
|
+
* A drag captures an element when their boxes overlap (within
|
|
51
|
+
* `tolerancePx`) — but NOT when the drag sits entirely inside the
|
|
52
|
+
* element. The latter case is the user dragging *within* a large
|
|
53
|
+
* container (a section, `<main>`, `<body>`) to lasso its children; the
|
|
54
|
+
* container itself isn't a thing they're trying to select, so we drop it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function doesRectIntersectSelection({ elementRect, selectionRect, tolerancePx, }: {
|
|
57
|
+
elementRect: SelectModeBoundingRect;
|
|
58
|
+
selectionRect: SelectModeBoundingRect;
|
|
59
|
+
tolerancePx: number;
|
|
60
|
+
}): boolean;
|
|
61
|
+
export type DragCandidate = {
|
|
62
|
+
id: string;
|
|
63
|
+
element: Element;
|
|
64
|
+
pageRect: SelectModeBoundingRect;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Snapshots every meaningful element and its page rect when a drag begins.
|
|
68
|
+
* Each candidate gets a stable id so the parent overlay can key its
|
|
69
|
+
* live highlights without remounting them as the drag moves.
|
|
70
|
+
*/
|
|
71
|
+
export declare function collectDragCandidates(scrollOffset: ScrollOffset): DragCandidate[];
|
|
72
|
+
/**
|
|
73
|
+
* Cheap per-move hit-test against the pre-collected candidates: keep the
|
|
74
|
+
* ones whose page rect overlaps the selection (excluding any that wholly
|
|
75
|
+
* enclose it), then collapse any fully-covered parent/children group down
|
|
76
|
+
* to just the parent (see `collapseFullyCoveredChildren`). Does no DOM
|
|
77
|
+
* queries or re-measures of geometry — the only DOM reads are cheap
|
|
78
|
+
* parent/child structural lookups.
|
|
79
|
+
*
|
|
80
|
+
* Because the collapse depends on which siblings are currently captured,
|
|
81
|
+
* elements legitimately move in and out of the result as the drag grows or
|
|
82
|
+
* shrinks: a child drops out the moment the drag swallows its last sibling
|
|
83
|
+
* (the parent takes over), and reappears if the drag retreats.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getCandidatesInSelection({ candidates, selectionPageRect, }: {
|
|
86
|
+
candidates: DragCandidate[];
|
|
87
|
+
selectionPageRect: SelectModeBoundingRect;
|
|
88
|
+
}): DragCandidate[];
|
|
89
|
+
/**
|
|
90
|
+
* Picks a "click position" for an element that fell inside an area
|
|
91
|
+
* selection. We use the corner of the element nearest the top-left of the
|
|
92
|
+
* selection rect, clamped to the element's own bounds. This anchor is what
|
|
93
|
+
* lets the selected-element overlay continue to track the element when the
|
|
94
|
+
* user scrolls (`useSelectionScrollSync` re-projects relative to it).
|
|
95
|
+
*
|
|
96
|
+
* @author Kevin O'Connell 2026-04-17
|
|
97
|
+
*/
|
|
98
|
+
export declare function getElementAnchor({ element, selectionRect, }: {
|
|
99
|
+
element: Element;
|
|
100
|
+
selectionRect: SelectModeBoundingRect;
|
|
101
|
+
}): SelectModeClickPosition;
|
|
102
|
+
/**
|
|
103
|
+
* @author Kevin O'Connell 2026-04-17
|
|
104
|
+
*/
|
|
105
|
+
export declare function getElementBoundingRect(element: Element): SelectModeBoundingRect;
|