@replohq/canopy-sdk 3.0.5 → 3.0.7
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/crypto.d.ts +8 -0
- package/_vendor/replo-utils/lib/errors.d.ts +1 -0
- package/_vendor/replo-utils/lib/fonts.d.ts +12 -1
- package/_vendor/replo-utils/lib/fonts.mjs +61 -12
- package/_vendor/replo-utils/lib/geometry.mjs +0 -2
- package/_vendor/replo-utils/lib/json.d.ts +0 -4
- package/_vendor/replo-utils/lib/json.mjs +1 -4
- package/_vendor/replo-utils/lib/misc.d.ts +4 -0
- package/_vendor/replo-utils/lib/misc.mjs +2 -4
- package/_vendor/replo-utils/lib/posthogReplay.mjs +0 -2
- package/_vendor/replo-utils/lib/string.d.ts +0 -12
- package/_vendor/replo-utils/lib/url.d.ts +10 -3
- package/_vendor/replo-utils/lib/url.mjs +3 -4
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +0 -1
- package/_vendor/schemas/agentBillingFeatureType.d.ts +1 -0
- package/_vendor/schemas/comments.d.ts +932 -0
- package/_vendor/schemas/designLibrary.d.ts +24 -1
- package/_vendor/schemas/designLibrary.mjs +76 -70
- package/_vendor/schemas/errors.d.ts +50 -45
- package/_vendor/schemas/generated/comments.d.ts +244 -0
- package/_vendor/schemas/generated/consent.d.ts +43 -2
- package/_vendor/schemas/generated/errors.d.ts +1 -0
- package/_vendor/schemas/generated/selectMode.d.ts +52 -1
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +64 -8
- package/_vendor/schemas/iframeRpcChannel.d.ts +13 -1
- package/_vendor/schemas/iframeRpcChannel.mjs +202 -19
- package/_vendor/schemas/loaderKeys.mjs +2 -4
- package/_vendor/schemas/{money.d.ts → moneyFormat.d.ts} +11 -9
- package/_vendor/schemas/moneyFormat.mjs +119 -0
- package/_vendor/schemas/pageAnnotations.d.ts +1 -1
- package/_vendor/schemas/pageAnnotations.mjs +1 -2
- package/_vendor/schemas/reploError.d.ts +43 -0
- package/_vendor/schemas/routing/match.mjs +0 -1
- package/_vendor/schemas/routing/rules.d.ts +2 -2
- package/_vendor/schemas/routing/rules.mjs +5 -8
- package/_vendor/schemas/savedStyles.d.ts +1 -1
- package/_vendor/schemas/selectMode.d.ts +272 -4
- package/_vendor/schemas/selectMode.mjs +4 -6
- package/_vendor/schemas/selectModeIframeRpc.d.ts +802 -111
- package/_vendor/schemas/selectModeIframeRpc.mjs +142 -47
- package/chunk-B7XDEXPL.mjs +19 -0
- package/chunk-CJIK4NVP.mjs +547 -0
- package/chunk-DINTPZM2.mjs +71 -0
- package/{chunk-AKZNN7F2.mjs → chunk-IQCJXNJU.mjs} +1 -1
- package/{chunk-H36NDYLG.mjs → chunk-PQEA6P4V.mjs} +40 -3
- package/{chunk-3A2F6BOM.mjs → chunk-YGLYUC6R.mjs} +21 -8
- package/editor/select-mode/iframeRpcChannel.d.ts +4 -4
- package/lib/tombstone.js +2 -2
- package/money.d.ts +1 -1
- package/orders/order-status-schema.d.ts +3 -3
- package/package.json +2 -2
- package/_vendor/replo-utils/lib/object.d.ts +0 -31
- package/_vendor/schemas/money.mjs +0 -1937
- package/chunk-544ZM65A.mjs +0 -203
- package/chunk-HGXQNZW7.mjs +0 -38
- package/chunk-ILGEM42C.mjs +0 -21
- package/chunk-QPGBIWJK.mjs +0 -195
- package/chunk-UJCSKKID.mjs +0 -23
- /package/{chunk-FNTGY7I5.mjs → chunk-JELVREEB.mjs} +0 -0
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
import { exhaustiveSwitch } from './chunk-PQEA6P4V.mjs';
|
|
2
|
+
import { parseJsonOrNull } from './chunk-B7XDEXPL.mjs';
|
|
3
|
+
import * as z from 'zod';
|
|
4
|
+
|
|
5
|
+
function parseSchemaOrNull(value, schema) {
|
|
6
|
+
const parseResult = schema.safeParse(value);
|
|
7
|
+
return parseResult.success ? parseResult.data : null;
|
|
8
|
+
}
|
|
9
|
+
z.string().min(1).refine((body) => body.trim().length > 0, {
|
|
10
|
+
message: "Write something before posting."
|
|
11
|
+
});
|
|
12
|
+
var commentSourceSchema = z.enum(["ui", "agent", "mcp", "api"]).describe("CommentSource");
|
|
13
|
+
var unitIntervalSchema = z.number().min(0).max(1);
|
|
14
|
+
var anchorUrlSchema = z.string().max(2048);
|
|
15
|
+
var anchorLocaleSchema = z.string().max(35);
|
|
16
|
+
var anchorSelectorSchema = z.string().max(4e3);
|
|
17
|
+
var anchorIdSchema = z.string().max(256);
|
|
18
|
+
var commentAnchorContextSchema = z.object({
|
|
19
|
+
url: anchorUrlSchema,
|
|
20
|
+
locale: anchorLocaleSchema.nullish()
|
|
21
|
+
}).describe("CommentAnchorContext");
|
|
22
|
+
var commentAnchorNoneSchema = z.object({
|
|
23
|
+
type: z.literal("none"),
|
|
24
|
+
context: commentAnchorContextSchema.optional()
|
|
25
|
+
}).describe("CommentAnchorNone");
|
|
26
|
+
var commentAnchorElementSchema = z.object({
|
|
27
|
+
type: z.literal("element"),
|
|
28
|
+
semanticSelector: anchorSelectorSchema.optional(),
|
|
29
|
+
selector: anchorSelectorSchema,
|
|
30
|
+
nthOfTypePath: anchorSelectorSchema,
|
|
31
|
+
source: z.object({
|
|
32
|
+
filePath: z.string().max(1024),
|
|
33
|
+
componentChain: z.array(anchorIdSchema).max(50),
|
|
34
|
+
line: z.number().int().optional(),
|
|
35
|
+
col: z.number().int().optional()
|
|
36
|
+
}).optional(),
|
|
37
|
+
listKey: anchorIdSchema.optional(),
|
|
38
|
+
tagName: z.string().max(64),
|
|
39
|
+
textPreview: z.string().max(200),
|
|
40
|
+
quote: z.object({
|
|
41
|
+
exact: z.string().max(2e3),
|
|
42
|
+
prefix: z.string().max(80),
|
|
43
|
+
suffix: z.string().max(80)
|
|
44
|
+
}).optional(),
|
|
45
|
+
offset: z.object({ x: unitIntervalSchema, y: unitIntervalSchema }),
|
|
46
|
+
context: commentAnchorContextSchema.optional()
|
|
47
|
+
}).describe("CommentAnchorElement");
|
|
48
|
+
var commentAnchorCanvasSchema = z.object({
|
|
49
|
+
type: z.literal("canvas"),
|
|
50
|
+
nodeId: anchorIdSchema,
|
|
51
|
+
layerId: anchorIdSchema.optional(),
|
|
52
|
+
point: z.object({ x: z.number(), y: z.number() }),
|
|
53
|
+
world: z.object({ x: z.number(), y: z.number() }).optional().describe("Set only for free-floating pins that sit on no node.")
|
|
54
|
+
}).describe("CommentAnchorCanvas");
|
|
55
|
+
var commentAnchorPointSchema = z.object({
|
|
56
|
+
type: z.literal("point"),
|
|
57
|
+
page: z.number().int().min(0).optional(),
|
|
58
|
+
x: unitIntervalSchema,
|
|
59
|
+
y: unitIntervalSchema
|
|
60
|
+
}).describe("CommentAnchorPoint");
|
|
61
|
+
var commentAnchorSchema = z.discriminatedUnion("type", [
|
|
62
|
+
commentAnchorNoneSchema,
|
|
63
|
+
commentAnchorElementSchema,
|
|
64
|
+
commentAnchorCanvasSchema,
|
|
65
|
+
commentAnchorPointSchema
|
|
66
|
+
]).describe("CommentAnchor");
|
|
67
|
+
var commentTargetSchema = z.discriminatedUnion("kind", [
|
|
68
|
+
z.object({
|
|
69
|
+
kind: z.literal("file"),
|
|
70
|
+
fileId: z.uuid(),
|
|
71
|
+
folderId: z.uuid().optional().describe(
|
|
72
|
+
"The artifact folder the comment was left from; the file must be one of its pages."
|
|
73
|
+
)
|
|
74
|
+
}),
|
|
75
|
+
z.object({
|
|
76
|
+
kind: z.literal("sitePage"),
|
|
77
|
+
siteId: z.uuid(),
|
|
78
|
+
url: anchorUrlSchema,
|
|
79
|
+
locale: anchorLocaleSchema.nullish(),
|
|
80
|
+
routePatternHint: anchorUrlSchema.optional(),
|
|
81
|
+
via: z.object({ fileId: z.uuid(), shareId: z.uuid() }).optional().describe(
|
|
82
|
+
"Set when the site preview is embedded in an artifact or canvas."
|
|
83
|
+
)
|
|
84
|
+
}),
|
|
85
|
+
z.object({ kind: z.literal("order"), orderId: z.uuid() }),
|
|
86
|
+
z.object({ kind: z.literal("asset"), assetId: z.uuid() }),
|
|
87
|
+
z.object({
|
|
88
|
+
kind: z.literal("experiment"),
|
|
89
|
+
experimentId: z.uuid().describe("The A/B test the notes belong to.")
|
|
90
|
+
})
|
|
91
|
+
]).describe("CommentTarget");
|
|
92
|
+
z.enum([
|
|
93
|
+
"artifact",
|
|
94
|
+
"canvas",
|
|
95
|
+
"image",
|
|
96
|
+
"markdown",
|
|
97
|
+
"pdf",
|
|
98
|
+
"file",
|
|
99
|
+
"websiteBuilder",
|
|
100
|
+
"embeddedPreview",
|
|
101
|
+
"orders",
|
|
102
|
+
"assets",
|
|
103
|
+
"experiments"
|
|
104
|
+
]).describe("CommentSurface");
|
|
105
|
+
var commentAuthorSchema = z.object({
|
|
106
|
+
id: z.string(),
|
|
107
|
+
name: z.string(),
|
|
108
|
+
avatarUrl: z.string().nullable(),
|
|
109
|
+
deleted: z.boolean()
|
|
110
|
+
}).describe("CommentAuthor");
|
|
111
|
+
var commentSchema = z.object({
|
|
112
|
+
id: z.string(),
|
|
113
|
+
threadId: z.string(),
|
|
114
|
+
authorUserId: z.string(),
|
|
115
|
+
source: commentSourceSchema,
|
|
116
|
+
body: z.string().describe("Empty when the comment is deleted."),
|
|
117
|
+
createdAt: z.iso.datetime(),
|
|
118
|
+
editedAt: z.iso.datetime().nullable(),
|
|
119
|
+
deletedAt: z.iso.datetime().nullable()
|
|
120
|
+
}).describe("Comment");
|
|
121
|
+
var commentReactionSchema = z.object({
|
|
122
|
+
commentId: z.string(),
|
|
123
|
+
userId: z.string(),
|
|
124
|
+
emoji: z.string(),
|
|
125
|
+
createdAt: z.iso.datetime()
|
|
126
|
+
}).describe("CommentReaction");
|
|
127
|
+
var commentThreadTargetSchema = z.object({
|
|
128
|
+
fileId: z.string().optional(),
|
|
129
|
+
siteId: z.string().optional(),
|
|
130
|
+
path: z.string().optional(),
|
|
131
|
+
orderId: z.string().optional(),
|
|
132
|
+
assetId: z.string().optional(),
|
|
133
|
+
experimentId: z.string().optional()
|
|
134
|
+
}).describe("CommentThreadTarget");
|
|
135
|
+
var commentThreadSchema = z.object({
|
|
136
|
+
id: z.string(),
|
|
137
|
+
projectId: z.string(),
|
|
138
|
+
target: commentThreadTargetSchema,
|
|
139
|
+
viaFileId: z.string().nullable(),
|
|
140
|
+
viaFileName: z.string().nullable(),
|
|
141
|
+
anchor: commentAnchorSchema,
|
|
142
|
+
resolvedAt: z.iso.datetime().nullable(),
|
|
143
|
+
resolvedByUserId: z.string().nullable(),
|
|
144
|
+
resolvedSource: commentSourceSchema.nullable(),
|
|
145
|
+
createdAt: z.iso.datetime(),
|
|
146
|
+
updatedAt: z.iso.datetime(),
|
|
147
|
+
deletedAt: z.iso.datetime().nullable()
|
|
148
|
+
}).describe("CommentThread");
|
|
149
|
+
var commentViewerSchema = z.object({
|
|
150
|
+
userId: z.string().nullable().describe("The signed-in caller; null for anonymous viewers."),
|
|
151
|
+
isMember: z.boolean().describe("Holds a role on the project, so object mentions are on."),
|
|
152
|
+
canComment: z.boolean(),
|
|
153
|
+
canModerate: z.boolean().describe("A workspace admin, who can delete anyone's comment (D-10).")
|
|
154
|
+
}).describe("CommentViewer");
|
|
155
|
+
z.object({
|
|
156
|
+
threads: z.array(commentThreadSchema),
|
|
157
|
+
comments: z.array(commentSchema),
|
|
158
|
+
reactions: z.array(commentReactionSchema),
|
|
159
|
+
authors: z.array(commentAuthorSchema),
|
|
160
|
+
viewer: commentViewerSchema
|
|
161
|
+
}).describe("CommentThreadBundle");
|
|
162
|
+
z.object({
|
|
163
|
+
id: z.uuid(),
|
|
164
|
+
target: commentTargetSchema,
|
|
165
|
+
anchor: commentAnchorSchema,
|
|
166
|
+
body: z.object({ id: z.uuid(), body: z.string() })
|
|
167
|
+
}).describe("CreateCommentThreadBody");
|
|
168
|
+
z.object({
|
|
169
|
+
resolved: z.boolean().optional(),
|
|
170
|
+
path: z.string().optional().describe("Moves the thread to another page and resets its anchor."),
|
|
171
|
+
anchor: commentAnchorSchema.optional()
|
|
172
|
+
}).refine(
|
|
173
|
+
(patch) => {
|
|
174
|
+
return patch.resolved !== void 0 || patch.path !== void 0 || patch.anchor !== void 0;
|
|
175
|
+
},
|
|
176
|
+
{ message: "Pass at least one of resolved, path or anchor." }
|
|
177
|
+
).refine((patch) => patch.path === void 0 || patch.anchor === void 0, {
|
|
178
|
+
message: "Move a thread or re-anchor it, not both at once."
|
|
179
|
+
}).describe("UpdateCommentThreadBody");
|
|
180
|
+
z.object({
|
|
181
|
+
id: z.uuid(),
|
|
182
|
+
body: z.string()
|
|
183
|
+
}).describe("CreateCommentBody");
|
|
184
|
+
z.object({
|
|
185
|
+
body: z.string()
|
|
186
|
+
}).describe("UpdateCommentBody");
|
|
187
|
+
var commentThreadStatusSchema = z.enum(["open", "resolved"]).describe("CommentThreadStatus");
|
|
188
|
+
z.object({
|
|
189
|
+
fileId: z.uuid().optional(),
|
|
190
|
+
folderId: z.uuid().optional().describe("Artifact folder: every page under it."),
|
|
191
|
+
siteId: z.uuid().optional(),
|
|
192
|
+
path: z.string().optional().describe(
|
|
193
|
+
"A concrete page path or a route pattern, normalized the same way a new comment's URL is."
|
|
194
|
+
),
|
|
195
|
+
locale: z.string().optional().describe("The locale prefixed to `path`, which is stripped first."),
|
|
196
|
+
viaFileId: z.uuid().optional(),
|
|
197
|
+
orderId: z.uuid().optional(),
|
|
198
|
+
assetId: z.uuid().optional(),
|
|
199
|
+
experimentId: z.uuid().optional(),
|
|
200
|
+
status: commentThreadStatusSchema.optional()
|
|
201
|
+
}).refine(
|
|
202
|
+
(query) => {
|
|
203
|
+
return [
|
|
204
|
+
query.fileId,
|
|
205
|
+
query.folderId,
|
|
206
|
+
query.siteId,
|
|
207
|
+
query.orderId,
|
|
208
|
+
query.assetId,
|
|
209
|
+
query.experimentId
|
|
210
|
+
].filter((value) => value !== void 0).length === 1;
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
message: "Exactly one of fileId, folderId, siteId, orderId, assetId or experimentId is required."
|
|
214
|
+
}
|
|
215
|
+
).refine(
|
|
216
|
+
(query) => {
|
|
217
|
+
return query.siteId !== void 0 || query.path === void 0 && query.locale === void 0 && query.viaFileId === void 0;
|
|
218
|
+
},
|
|
219
|
+
{ message: "path, locale and viaFileId require siteId." }
|
|
220
|
+
).describe("ListCommentThreadsQuery");
|
|
221
|
+
z.object({
|
|
222
|
+
kind: z.enum(["artifact", "miniapp", "commentsScreen", "gone"]),
|
|
223
|
+
url: z.string().optional(),
|
|
224
|
+
projectId: z.string().optional().describe(
|
|
225
|
+
"The thread's project, set for miniapp and commentsScreen locations so the dashboard can build the project route."
|
|
226
|
+
),
|
|
227
|
+
miniappId: z.string().optional(),
|
|
228
|
+
miniappRoute: z.string().optional()
|
|
229
|
+
}).describe("CommentThreadLocation");
|
|
230
|
+
z.object({
|
|
231
|
+
target: commentTargetSchema,
|
|
232
|
+
contentType: z.string(),
|
|
233
|
+
contentLength: z.number().int().positive()
|
|
234
|
+
}).describe("PresignCommentAttachmentBody");
|
|
235
|
+
z.object({
|
|
236
|
+
objectKey: z.string(),
|
|
237
|
+
presignedPutUrl: z.string(),
|
|
238
|
+
publicUrl: z.string()
|
|
239
|
+
}).describe("PresignCommentAttachmentResponse");
|
|
240
|
+
z.object({
|
|
241
|
+
target: commentTargetSchema,
|
|
242
|
+
objectKey: z.string()
|
|
243
|
+
}).describe("CommitCommentAttachmentBody");
|
|
244
|
+
z.object({
|
|
245
|
+
publicUrl: z.string()
|
|
246
|
+
}).describe("CommitCommentAttachmentResponse");
|
|
247
|
+
z.object({
|
|
248
|
+
column: z.enum([
|
|
249
|
+
"page",
|
|
250
|
+
"excerpt",
|
|
251
|
+
"author",
|
|
252
|
+
"created",
|
|
253
|
+
"lastActivity",
|
|
254
|
+
"replies",
|
|
255
|
+
"status",
|
|
256
|
+
"from"
|
|
257
|
+
]),
|
|
258
|
+
direction: z.enum(["asc", "desc"])
|
|
259
|
+
}).describe("CommentSiteThreadSort");
|
|
260
|
+
z.object({
|
|
261
|
+
threads: z.array(commentThreadSchema),
|
|
262
|
+
comments: z.array(commentSchema),
|
|
263
|
+
reactions: z.array(commentReactionSchema),
|
|
264
|
+
authors: z.array(commentAuthorSchema),
|
|
265
|
+
orphanedPaths: z.array(z.string()).nullable().describe(
|
|
266
|
+
"Paths on this page with no current site page; null when the site's pages couldn't be read."
|
|
267
|
+
),
|
|
268
|
+
nextCursor: z.string().nullable()
|
|
269
|
+
}).describe("CommentSiteThreadPage");
|
|
270
|
+
z.object({
|
|
271
|
+
id: z.string(),
|
|
272
|
+
name: z.string(),
|
|
273
|
+
avatarUrl: z.string().nullable()
|
|
274
|
+
}).describe("CommentMentionPerson");
|
|
275
|
+
var mentionableDisplaySchema = z.object({
|
|
276
|
+
label: z.string(),
|
|
277
|
+
imageUrl: z.string().optional()
|
|
278
|
+
}).describe("MentionableDisplay");
|
|
279
|
+
z.discriminatedUnion("state", [
|
|
280
|
+
z.object({ state: z.literal("ok"), display: mentionableDisplaySchema }),
|
|
281
|
+
z.object({
|
|
282
|
+
state: z.literal("forbidden"),
|
|
283
|
+
category: z.string().describe(
|
|
284
|
+
`A category label such as "File", never the object's title.`
|
|
285
|
+
)
|
|
286
|
+
})
|
|
287
|
+
]).describe("MentionableResolution");
|
|
288
|
+
var commentThreadTargetSummarySchema = z.object({
|
|
289
|
+
kind: z.enum(["file", "sitePage", "order", "asset", "experiment"]),
|
|
290
|
+
fileId: z.string().optional(),
|
|
291
|
+
fileName: z.string().optional(),
|
|
292
|
+
filePath: z.string().optional().describe("The file's path from its project's root folder."),
|
|
293
|
+
artifactFolderId: z.string().optional().describe("Set when the file is a page of an artifact."),
|
|
294
|
+
fileDeleted: z.boolean().optional().describe("True when the commented file no longer exists."),
|
|
295
|
+
siteId: z.string().optional(),
|
|
296
|
+
path: z.string().optional().describe("The site route pattern."),
|
|
297
|
+
url: z.string().optional().describe("The concrete page URL the comment was left on."),
|
|
298
|
+
orderId: z.string().optional(),
|
|
299
|
+
assetId: z.string().optional(),
|
|
300
|
+
experimentId: z.string().optional(),
|
|
301
|
+
experimentName: z.string().optional()
|
|
302
|
+
}).describe("CommentThreadTargetSummary");
|
|
303
|
+
z.object({
|
|
304
|
+
thread: commentThreadSchema,
|
|
305
|
+
comments: z.array(commentSchema),
|
|
306
|
+
reactions: z.array(commentReactionSchema),
|
|
307
|
+
authors: z.array(commentAuthorSchema),
|
|
308
|
+
target: commentThreadTargetSummarySchema
|
|
309
|
+
}).describe("CommentThreadDetail");
|
|
310
|
+
|
|
311
|
+
var SELECT_MODE_SELECTABLE_ATTRIBUTE = "data-replo-selectable";
|
|
312
|
+
var SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE = "data-replo-selectable-payload";
|
|
313
|
+
var displayModeSchema = z.enum(["browse", "selection", "comment"]).describe("DisplayMode");
|
|
314
|
+
var selectModeInlineTextStatusSchema = z.enum(["editable", "dynamic", "translated"]).nullable().describe("SelectModeInlineTextStatus");
|
|
315
|
+
var selectModeTextMetricsSchema = z.object({
|
|
316
|
+
tightWidth: z.number(),
|
|
317
|
+
lineCount: z.number(),
|
|
318
|
+
lineHeight: z.number()
|
|
319
|
+
}).describe("SelectModeTextMetrics");
|
|
320
|
+
var selectModeClickPositionSchema = z.object({
|
|
321
|
+
x: z.number(),
|
|
322
|
+
y: z.number()
|
|
323
|
+
}).describe("SelectModeClickPosition");
|
|
324
|
+
var selectModeSourceLocationSchema = z.object({
|
|
325
|
+
filePath: z.string(),
|
|
326
|
+
lineNumber: z.number(),
|
|
327
|
+
columnNumber: z.number().optional(),
|
|
328
|
+
componentName: z.string().optional()
|
|
329
|
+
}).describe("SelectModeSourceLocation");
|
|
330
|
+
var selectModeFiberChainEntrySchema = z.object({
|
|
331
|
+
sourceLocation: selectModeSourceLocationSchema,
|
|
332
|
+
tagName: z.string().optional(),
|
|
333
|
+
componentName: z.string().optional(),
|
|
334
|
+
props: z.record(z.string(), z.unknown()).optional()
|
|
335
|
+
}).describe("SelectModeFiberChainEntry");
|
|
336
|
+
var selectModeBoundingRectSchema = z.object({
|
|
337
|
+
x: z.number(),
|
|
338
|
+
y: z.number(),
|
|
339
|
+
left: z.number(),
|
|
340
|
+
top: z.number(),
|
|
341
|
+
right: z.number(),
|
|
342
|
+
bottom: z.number(),
|
|
343
|
+
width: z.number(),
|
|
344
|
+
height: z.number()
|
|
345
|
+
}).describe("SelectModeBoundingRect");
|
|
346
|
+
var selectModeHoverRectSchema = selectModeBoundingRectSchema.extend({ isSection: z.boolean().optional() }).describe("SelectModeHoverRect");
|
|
347
|
+
var selectModeSelectionRectSchema = z.object({
|
|
348
|
+
id: z.string(),
|
|
349
|
+
rect: selectModeBoundingRectSchema
|
|
350
|
+
}).describe("SelectModeSelectionRect");
|
|
351
|
+
var selectModeStyleAtRuleSchema = z.object({
|
|
352
|
+
type: z.string(),
|
|
353
|
+
text: z.string()
|
|
354
|
+
}).describe("SelectModeStyleAtRule");
|
|
355
|
+
var selectModeStyleVariantSchema = z.object({
|
|
356
|
+
atRules: z.array(selectModeStyleAtRuleSchema),
|
|
357
|
+
pseudo: z.string().nullable()
|
|
358
|
+
}).describe("SelectModeStyleVariant");
|
|
359
|
+
var selectModeDefinedStyleSchema = z.object({
|
|
360
|
+
property: z.string(),
|
|
361
|
+
variant: selectModeStyleVariantSchema.nullable(),
|
|
362
|
+
className: z.string().nullable(),
|
|
363
|
+
raw: z.string(),
|
|
364
|
+
resolved: z.string()
|
|
365
|
+
}).describe("SelectModeDefinedStyle");
|
|
366
|
+
function transformRect({
|
|
367
|
+
rect,
|
|
368
|
+
offset,
|
|
369
|
+
scale = 1
|
|
370
|
+
}) {
|
|
371
|
+
return {
|
|
372
|
+
x: rect.x * scale + offset.left,
|
|
373
|
+
y: rect.y * scale + offset.top,
|
|
374
|
+
left: rect.left * scale + offset.left,
|
|
375
|
+
right: rect.right * scale + offset.left,
|
|
376
|
+
top: rect.top * scale + offset.top,
|
|
377
|
+
bottom: rect.bottom * scale + offset.top,
|
|
378
|
+
width: rect.width * scale,
|
|
379
|
+
height: rect.height * scale
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function transformPoint({
|
|
383
|
+
point,
|
|
384
|
+
offset,
|
|
385
|
+
scale = 1
|
|
386
|
+
}) {
|
|
387
|
+
return {
|
|
388
|
+
x: point.x * scale + offset.left,
|
|
389
|
+
y: point.y * scale + offset.top
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function getIframeOffset(iframe) {
|
|
393
|
+
if (!iframe) {
|
|
394
|
+
return { left: 0, top: 0 };
|
|
395
|
+
}
|
|
396
|
+
const iframeRect = iframe.getBoundingClientRect();
|
|
397
|
+
return { left: iframeRect.left, top: iframeRect.top };
|
|
398
|
+
}
|
|
399
|
+
var selectModeImageScopeSchema = z.discriminatedUnion("kind", [
|
|
400
|
+
z.object({ kind: z.literal("all") }),
|
|
401
|
+
z.object({ kind: z.literal("media"), media: z.string() })
|
|
402
|
+
]).describe("SelectModeImageScope");
|
|
403
|
+
var selectModeImageSourceSchema = z.object({
|
|
404
|
+
srcSet: z.string(),
|
|
405
|
+
sizes: z.string(),
|
|
406
|
+
media: z.string(),
|
|
407
|
+
type: z.string(),
|
|
408
|
+
previewUrl: z.string().nullable()
|
|
409
|
+
}).describe("SelectModeImageSource");
|
|
410
|
+
var selectModeImageSchema = z.object({
|
|
411
|
+
src: z.string(),
|
|
412
|
+
currentSrc: z.string(),
|
|
413
|
+
srcSet: z.string(),
|
|
414
|
+
sizes: z.string(),
|
|
415
|
+
previewUrl: z.string().nullable(),
|
|
416
|
+
sources: z.array(selectModeImageSourceSchema)
|
|
417
|
+
}).describe("SelectModeImage");
|
|
418
|
+
var selectModeVideoSchema = z.object({
|
|
419
|
+
src: z.string(),
|
|
420
|
+
currentSrc: z.string()
|
|
421
|
+
}).describe("SelectModeVideo");
|
|
422
|
+
var selectedElementSchema = z.object({
|
|
423
|
+
kind: z.literal("react-element"),
|
|
424
|
+
selector: z.string(),
|
|
425
|
+
section: z.object({ selector: z.string() }).optional(),
|
|
426
|
+
tagName: z.string(),
|
|
427
|
+
elementType: z.string(),
|
|
428
|
+
textContent: z.string().nullable(),
|
|
429
|
+
sectionLabel: z.string().optional(),
|
|
430
|
+
rect: selectModeBoundingRectSchema,
|
|
431
|
+
textMetrics: selectModeTextMetricsSchema.nullable(),
|
|
432
|
+
outerHTML: z.string(),
|
|
433
|
+
image: selectModeImageSchema.optional(),
|
|
434
|
+
video: selectModeVideoSchema.optional(),
|
|
435
|
+
definedStyles: z.array(selectModeDefinedStyleSchema).default([]),
|
|
436
|
+
authoredStyles: z.record(z.string(), z.string()).default({}).describe(
|
|
437
|
+
"Authored CSS value of the winning declaration per control property, custom properties expanded (e.g. 1.5rem for text-2xl at a wide viewport)."
|
|
438
|
+
),
|
|
439
|
+
inheritedStyles: z.record(z.string(), z.string()).default({}),
|
|
440
|
+
clickPosition: selectModeClickPositionSchema,
|
|
441
|
+
sourceLocation: selectModeSourceLocationSchema.optional(),
|
|
442
|
+
fiberChain: z.array(selectModeFiberChainEntrySchema).default([]),
|
|
443
|
+
siblingSelectors: z.array(z.string()).default([]),
|
|
444
|
+
anchor: commentAnchorElementSchema.optional().describe(
|
|
445
|
+
"The comments capture of the same element, so a selection can become a comment anchor."
|
|
446
|
+
)
|
|
447
|
+
}).describe("SelectedElement");
|
|
448
|
+
var selectablePlanDataSchema = z.object({
|
|
449
|
+
kind: z.literal("plan"),
|
|
450
|
+
planId: z.string(),
|
|
451
|
+
label: z.string(),
|
|
452
|
+
rect: selectModeBoundingRectSchema
|
|
453
|
+
}).describe("SelectablePlanData");
|
|
454
|
+
var selectablePlanPayloadSchema = selectablePlanDataSchema.omit({ rect: true }).describe("SelectablePlanPayload");
|
|
455
|
+
var selectableDataPayloadSchema = z.discriminatedUnion("kind", [selectablePlanPayloadSchema]).describe("SelectableDataPayload");
|
|
456
|
+
var selectableDataSchema = z.discriminatedUnion("kind", [selectedElementSchema, selectablePlanDataSchema]).describe("SelectableData");
|
|
457
|
+
function isSelectedSection(data) {
|
|
458
|
+
return data.kind === "react-element" && data.selector === data.section?.selector;
|
|
459
|
+
}
|
|
460
|
+
function transformSelectedElement({
|
|
461
|
+
element,
|
|
462
|
+
offset,
|
|
463
|
+
scale = 1
|
|
464
|
+
}) {
|
|
465
|
+
return {
|
|
466
|
+
...element,
|
|
467
|
+
rect: transformRect({ rect: element.rect, offset, scale }),
|
|
468
|
+
clickPosition: transformPoint({
|
|
469
|
+
point: element.clickPosition,
|
|
470
|
+
offset,
|
|
471
|
+
scale
|
|
472
|
+
})
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function transformSelectableData({
|
|
476
|
+
data,
|
|
477
|
+
offset
|
|
478
|
+
}) {
|
|
479
|
+
return exhaustiveSwitch(
|
|
480
|
+
data,
|
|
481
|
+
"kind"
|
|
482
|
+
)({
|
|
483
|
+
"react-element": (element) => transformSelectedElement({ element, offset }),
|
|
484
|
+
plan: (plan) => ({
|
|
485
|
+
...plan,
|
|
486
|
+
rect: transformRect({ rect: plan.rect, offset })
|
|
487
|
+
})
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
function readSelectablePayload(rawPayload) {
|
|
491
|
+
if (!rawPayload) {
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
const parsedPayload = parseJsonOrNull(rawPayload);
|
|
495
|
+
if (!parsedPayload) {
|
|
496
|
+
return null;
|
|
497
|
+
}
|
|
498
|
+
return parseSchemaOrNull(parsedPayload, selectableDataPayloadSchema);
|
|
499
|
+
}
|
|
500
|
+
var selectModeOptimisticUpdatePayloadSchema = z.discriminatedUnion("kind", [
|
|
501
|
+
z.object({
|
|
502
|
+
kind: z.literal("image"),
|
|
503
|
+
image: selectModeImageSchema
|
|
504
|
+
}),
|
|
505
|
+
z.object({
|
|
506
|
+
kind: z.literal("css"),
|
|
507
|
+
fontSource: z.enum(["google", "site"]).optional(),
|
|
508
|
+
property: z.string(),
|
|
509
|
+
value: z.string().nullable()
|
|
510
|
+
}),
|
|
511
|
+
z.object({
|
|
512
|
+
kind: z.literal("content"),
|
|
513
|
+
innerHTML: z.string()
|
|
514
|
+
}),
|
|
515
|
+
z.object({
|
|
516
|
+
kind: z.literal("attribute"),
|
|
517
|
+
name: z.string(),
|
|
518
|
+
value: z.string()
|
|
519
|
+
})
|
|
520
|
+
]).describe("SelectModeOptimisticUpdatePayload");
|
|
521
|
+
var selectModeTiptapActiveMarksSchema = z.object({
|
|
522
|
+
bold: z.boolean(),
|
|
523
|
+
italic: z.boolean(),
|
|
524
|
+
underline: z.boolean(),
|
|
525
|
+
strike: z.boolean()
|
|
526
|
+
}).describe("SelectModeTiptapActiveMarks");
|
|
527
|
+
var selectModeFormatCommandSchema = z.enum(["toggleBold", "toggleItalic", "toggleUnderline", "toggleStrike"]).describe("SelectModeFormatCommand");
|
|
528
|
+
var selectModeSelectionTypeSchema = z.enum(["none", "element", "area", "drag"]).describe("SelectModeSelectionType");
|
|
529
|
+
var selectModeSelectionSchema = z.discriminatedUnion("type", [
|
|
530
|
+
z.object({ type: z.literal("none") }),
|
|
531
|
+
z.object({
|
|
532
|
+
type: z.literal("element"),
|
|
533
|
+
data: selectableDataSchema
|
|
534
|
+
}),
|
|
535
|
+
z.object({
|
|
536
|
+
type: z.literal("area"),
|
|
537
|
+
rect: selectModeBoundingRectSchema,
|
|
538
|
+
items: z.array(selectableDataSchema)
|
|
539
|
+
}),
|
|
540
|
+
z.object({
|
|
541
|
+
type: z.literal("drag"),
|
|
542
|
+
dragRect: selectModeBoundingRectSchema,
|
|
543
|
+
selectionRects: z.array(selectModeSelectionRectSchema)
|
|
544
|
+
})
|
|
545
|
+
]).describe("SelectModeSelection");
|
|
546
|
+
|
|
547
|
+
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, selectModeVideoSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { randomUUID, randomFillSync } from 'crypto';
|
|
2
|
+
|
|
3
|
+
var byteToHex = [];
|
|
4
|
+
for (let i = 0; i < 256; ++i) {
|
|
5
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
6
|
+
}
|
|
7
|
+
function unsafeStringify(arr, offset = 0) {
|
|
8
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
9
|
+
}
|
|
10
|
+
var rnds8Pool = new Uint8Array(256);
|
|
11
|
+
var poolPtr = rnds8Pool.length;
|
|
12
|
+
function rng() {
|
|
13
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
14
|
+
randomFillSync(rnds8Pool);
|
|
15
|
+
poolPtr = 0;
|
|
16
|
+
}
|
|
17
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
18
|
+
}
|
|
19
|
+
var native_default = { randomUUID };
|
|
20
|
+
|
|
21
|
+
function v4(options, buf, offset) {
|
|
22
|
+
if (native_default.randomUUID && !buf && !options) {
|
|
23
|
+
return native_default.randomUUID();
|
|
24
|
+
}
|
|
25
|
+
options = options || {};
|
|
26
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
27
|
+
if (rnds.length < 16) {
|
|
28
|
+
throw new Error("Random bytes length must be >= 16");
|
|
29
|
+
}
|
|
30
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
31
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
32
|
+
if (buf) {
|
|
33
|
+
offset = offset || 0;
|
|
34
|
+
if (offset < 0 || offset + 16 > buf.length) {
|
|
35
|
+
throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
|
|
36
|
+
}
|
|
37
|
+
for (let i = 0; i < 16; ++i) {
|
|
38
|
+
buf[offset + i] = rnds[i];
|
|
39
|
+
}
|
|
40
|
+
return buf;
|
|
41
|
+
}
|
|
42
|
+
return unsafeStringify(rnds);
|
|
43
|
+
}
|
|
44
|
+
var v4_default = v4;
|
|
45
|
+
|
|
46
|
+
function randomUUID2() {
|
|
47
|
+
return v4_default();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var ReploError = class _ReploError extends Error {
|
|
51
|
+
config;
|
|
52
|
+
id;
|
|
53
|
+
constructor(config) {
|
|
54
|
+
super(config.message);
|
|
55
|
+
this.message = config.message ?? this.constructor.name;
|
|
56
|
+
this.config = config;
|
|
57
|
+
this.id = randomUUID2();
|
|
58
|
+
const cause = config.cause;
|
|
59
|
+
if (cause) {
|
|
60
|
+
this.cause = cause;
|
|
61
|
+
if (cause instanceof _ReploError) {
|
|
62
|
+
this.config.additionalData = {
|
|
63
|
+
...this.config.additionalData,
|
|
64
|
+
...cause.config.additionalData
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { ReploError, randomUUID2 as randomUUID };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Symbol_default, isArray_default, isObjectLike_default, baseGetTag_default } from './chunk-
|
|
1
|
+
import { Symbol_default, isArray_default, isObjectLike_default, baseGetTag_default } from './chunk-JELVREEB.mjs';
|
|
2
2
|
|
|
3
3
|
function arrayMap(array, iteratee) {
|
|
4
4
|
var index = -1, length = array == null ? 0 : array.length, result = Array(length);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { root_default, isObjectLike_default, freeGlobal_default, baseGetTag_default, Symbol_default, isArray_default } from './chunk-FNTGY7I5.mjs';
|
|
1
|
+
import { root_default, isObjectLike_default, freeGlobal_default, baseGetTag_default, Symbol_default, isArray_default } from './chunk-JELVREEB.mjs';
|
|
3
2
|
|
|
4
3
|
function listCacheClear() {
|
|
5
4
|
this.__data__ = [];
|
|
@@ -102,6 +101,12 @@ function stackHas(key) {
|
|
|
102
101
|
}
|
|
103
102
|
var stackHas_default = stackHas;
|
|
104
103
|
|
|
104
|
+
function isObject(value) {
|
|
105
|
+
var type = typeof value;
|
|
106
|
+
return value != null && (type == "object" || type == "function");
|
|
107
|
+
}
|
|
108
|
+
var isObject_default = isObject;
|
|
109
|
+
|
|
105
110
|
var asyncTag = "[object AsyncFunction]";
|
|
106
111
|
var funcTag = "[object Function]";
|
|
107
112
|
var genTag = "[object GeneratorFunction]";
|
|
@@ -1033,6 +1038,18 @@ function isEmpty(value) {
|
|
|
1033
1038
|
}
|
|
1034
1039
|
var isEmpty_default = isEmpty;
|
|
1035
1040
|
|
|
1041
|
+
var numberTag4 = "[object Number]";
|
|
1042
|
+
function isNumber(value) {
|
|
1043
|
+
return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag4;
|
|
1044
|
+
}
|
|
1045
|
+
var isNumber_default = isNumber;
|
|
1046
|
+
|
|
1047
|
+
var stringTag4 = "[object String]";
|
|
1048
|
+
function isString(value) {
|
|
1049
|
+
return typeof value == "string" || !isArray_default(value) && isObjectLike_default(value) && baseGetTag_default(value) == stringTag4;
|
|
1050
|
+
}
|
|
1051
|
+
var isString_default = isString;
|
|
1052
|
+
|
|
1036
1053
|
function assignMergeValue(object, key, value) {
|
|
1037
1054
|
if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) {
|
|
1038
1055
|
baseAssignValue_default(object, key, value);
|
|
@@ -1379,6 +1396,26 @@ function formatFileSize(byteCount, decimalPlaces = 0) {
|
|
|
1379
1396
|
var sleep = async (ms) => {
|
|
1380
1397
|
return await new Promise((resolve) => setTimeout(resolve, ms));
|
|
1381
1398
|
};
|
|
1399
|
+
function sleepWithSignal({
|
|
1400
|
+
delayMs,
|
|
1401
|
+
signal
|
|
1402
|
+
}) {
|
|
1403
|
+
if (signal === null) {
|
|
1404
|
+
return sleep(delayMs);
|
|
1405
|
+
}
|
|
1406
|
+
signal.throwIfAborted();
|
|
1407
|
+
return new Promise((resolve, reject) => {
|
|
1408
|
+
const onAbort = () => {
|
|
1409
|
+
clearTimeout(timeoutId);
|
|
1410
|
+
reject(signal.reason);
|
|
1411
|
+
};
|
|
1412
|
+
const timeoutId = setTimeout(() => {
|
|
1413
|
+
signal.removeEventListener("abort", onAbort);
|
|
1414
|
+
resolve();
|
|
1415
|
+
}, delayMs);
|
|
1416
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1382
1419
|
function errorMessage(error) {
|
|
1383
1420
|
if (error instanceof Error) {
|
|
1384
1421
|
return error.message;
|
|
@@ -1390,4 +1427,4 @@ function errorMessage(error) {
|
|
|
1390
1427
|
return String(error);
|
|
1391
1428
|
}
|
|
1392
1429
|
|
|
1393
|
-
export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty12 as hasOwnProperty, invariant, isEmpty2 as isEmpty, isFunction_default, isNotNullish, isNullish, isPrimitive, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, warning };
|
|
1430
|
+
export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty12 as hasOwnProperty, invariant, isEmpty2 as isEmpty, isFunction_default, isNotNullish, isNullish, isNumber_default, isPrimitive, isString_default, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, sleepWithSignal, warning };
|