@replohq/canopy-sdk 3.0.5 → 3.0.6
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/lib/fonts.d.ts +12 -1
- package/_vendor/replo-utils/lib/fonts.mjs +59 -9
- package/_vendor/replo-utils/lib/misc.d.ts +4 -0
- package/_vendor/replo-utils/lib/misc.mjs +1 -1
- package/_vendor/replo-utils/lib/url.mjs +1 -1
- package/_vendor/schemas/designLibrary.d.ts +23 -0
- package/_vendor/schemas/designLibrary.mjs +8 -1
- package/_vendor/schemas/errors.d.ts +14 -0
- package/_vendor/schemas/generated/selectMode.d.ts +49 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +21 -8
- package/_vendor/schemas/iframeRpcChannel.mjs +37 -13
- package/_vendor/schemas/loaderKeys.mjs +2 -2
- package/_vendor/schemas/money.mjs +2 -2
- package/_vendor/schemas/routing/rules.mjs +3 -3
- package/_vendor/schemas/selectMode.d.ts +155 -0
- package/_vendor/schemas/selectMode.mjs +2 -2
- package/_vendor/schemas/selectModeIframeRpc.d.ts +429 -110
- package/_vendor/schemas/selectModeIframeRpc.mjs +68 -41
- package/{chunk-3A2F6BOM.mjs → chunk-DINXH6YP.mjs} +3 -1
- package/{chunk-H36NDYLG.mjs → chunk-EXI4VDHP.mjs} +21 -1
- package/{chunk-544ZM65A.mjs → chunk-RLFL66ST.mjs} +41 -2
- package/{chunk-QPGBIWJK.mjs → chunk-VUXOGD76.mjs} +12 -1
- package/editor/select-mode/iframeRpcChannel.d.ts +4 -4
- package/lib/tombstone.js +2 -2
- package/orders/order-status-schema.d.ts +3 -3
- package/package.json +1 -1
|
@@ -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 {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/** Known symbol assets are not text typefaces; unknown families stay eligible. */
|
|
2
2
|
export declare function isKnownSymbolFontFamily(family: string): boolean;
|
|
3
|
+
/** Words a family name carries for packaging rather than design: "Inter Display", "Avenir Web". */
|
|
4
|
+
export declare const FONT_DESCRIPTOR_WORDS: Set<string>;
|
|
5
|
+
/** Weight and style words a family name can carry: "Avenir Book", "Graphik Semibold". */
|
|
6
|
+
export declare const FONT_VARIANT_WORDS: Set<string>;
|
|
7
|
+
export declare const FONT_STYLE_WORDS: Set<string>;
|
|
8
|
+
export declare function stripCssQuotes(value: string): string;
|
|
9
|
+
/** "InterDisplay-Bold", "'Inter Display'" → "inter display bold", "inter display": camel case split, punctuation to spaces, lower case. */
|
|
10
|
+
export declare function normalizeFontFamilyName(value: string): string;
|
|
11
|
+
/** The key two family names share when they are the same typeface: Brand Studio's alias minus weight, style and packaging words ("Avenir Book" → "avenir"), stricter than the first-word alias. */
|
|
12
|
+
export declare function fontFamilyKey(family: string): string;
|
|
3
13
|
export declare function getTypographyFonts<FontType extends {
|
|
4
14
|
family: string;
|
|
5
15
|
faces: {
|
|
@@ -48,10 +58,11 @@ export declare function fontFormatFromMimeType(mimeType: string): string;
|
|
|
48
58
|
/**
|
|
49
59
|
* The @font-face rule that makes a custom family renderable from its asset URL.
|
|
50
60
|
*/
|
|
51
|
-
export declare function buildFontFaceCss({ family, faceUrl, format, weight, }: {
|
|
61
|
+
export declare function buildFontFaceCss({ family, faceUrl, format, weight, style, }: {
|
|
52
62
|
family: string;
|
|
53
63
|
faceUrl: string;
|
|
54
64
|
format: string;
|
|
55
65
|
weight?: number;
|
|
66
|
+
style?: "normal" | "italic";
|
|
56
67
|
}): string;
|
|
57
68
|
export declare const escapeFontFamilyName: (fontFamily: string) => string;
|
|
@@ -13,6 +13,43 @@ function isKnownSymbolFontFamily(family) {
|
|
|
13
13
|
normalized.replace(/[\s_-]/gu, "")
|
|
14
14
|
);
|
|
15
15
|
}
|
|
16
|
+
var FONT_DESCRIPTOR_WORDS = /* @__PURE__ */ new Set([
|
|
17
|
+
"display",
|
|
18
|
+
"international",
|
|
19
|
+
"intl",
|
|
20
|
+
"m",
|
|
21
|
+
"text",
|
|
22
|
+
"web",
|
|
23
|
+
"webfont",
|
|
24
|
+
"webm"
|
|
25
|
+
]);
|
|
26
|
+
var FONT_VARIANT_WORDS = /* @__PURE__ */ new Set([
|
|
27
|
+
"black",
|
|
28
|
+
"bold",
|
|
29
|
+
"book",
|
|
30
|
+
"extrabold",
|
|
31
|
+
"italic",
|
|
32
|
+
"light",
|
|
33
|
+
"medium",
|
|
34
|
+
"regular",
|
|
35
|
+
"semibold",
|
|
36
|
+
"thin"
|
|
37
|
+
]);
|
|
38
|
+
var FONT_STYLE_WORDS = /* @__PURE__ */ new Set([
|
|
39
|
+
...FONT_DESCRIPTOR_WORDS,
|
|
40
|
+
...FONT_VARIANT_WORDS
|
|
41
|
+
]);
|
|
42
|
+
function stripCssQuotes(value) {
|
|
43
|
+
return value.trim().replace(/\\(["'])/gu, "$1").replace(/^["']|["']$/gu, "");
|
|
44
|
+
}
|
|
45
|
+
function normalizeFontFamilyName(value) {
|
|
46
|
+
return stripCssQuotes(value).replace(/([a-z])([A-Z])/gu, "$1 $2").replace(/([A-Z])([A-Z][a-z])/gu, "$1 $2").replace(/[^a-z0-9]+/giu, " ").trim().replace(/\s+/gu, " ").toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
function fontFamilyKey(family) {
|
|
49
|
+
const words = normalizeFontFamilyName(family).split(" ").filter(Boolean);
|
|
50
|
+
const kept = words.filter((word) => !FONT_STYLE_WORDS.has(word));
|
|
51
|
+
return (kept.length > 0 ? kept : words).join(" ");
|
|
52
|
+
}
|
|
16
53
|
function getTypographyFonts(fonts) {
|
|
17
54
|
return fonts.filter((font) => {
|
|
18
55
|
return !isKnownSymbolFontFamily(font.family) && (font.faces.length === 0 || font.faces.some((face) => !isKnownSymbolFontFamily(face.cssFamily)));
|
|
@@ -61,16 +98,28 @@ function describeFontFile(fileName) {
|
|
|
61
98
|
}
|
|
62
99
|
function fontFormatFromExtension(extension) {
|
|
63
100
|
const normalized = extension.toLowerCase().replace(/^\./u, "");
|
|
64
|
-
if (normalized === "woff2")
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (normalized === "
|
|
101
|
+
if (normalized === "woff2") {
|
|
102
|
+
return "woff2";
|
|
103
|
+
}
|
|
104
|
+
if (normalized === "woff") {
|
|
105
|
+
return "woff";
|
|
106
|
+
}
|
|
107
|
+
if (normalized === "otf") {
|
|
108
|
+
return "opentype";
|
|
109
|
+
}
|
|
110
|
+
if (normalized === "ttf") {
|
|
111
|
+
return "truetype";
|
|
112
|
+
}
|
|
68
113
|
return "woff2";
|
|
69
114
|
}
|
|
70
115
|
function fontFormatFromMimeType(mimeType) {
|
|
71
116
|
const normalized = mimeType.toLowerCase();
|
|
72
|
-
if (normalized.includes("woff2"))
|
|
73
|
-
|
|
117
|
+
if (normalized.includes("woff2")) {
|
|
118
|
+
return "woff2";
|
|
119
|
+
}
|
|
120
|
+
if (normalized.includes("woff")) {
|
|
121
|
+
return "woff";
|
|
122
|
+
}
|
|
74
123
|
if (normalized.includes("otf") || normalized.includes("opentype")) {
|
|
75
124
|
return "opentype";
|
|
76
125
|
}
|
|
@@ -86,12 +135,13 @@ function buildFontFaceCss({
|
|
|
86
135
|
family,
|
|
87
136
|
faceUrl,
|
|
88
137
|
format,
|
|
89
|
-
weight = 400
|
|
138
|
+
weight = 400,
|
|
139
|
+
style = "normal"
|
|
90
140
|
}) {
|
|
91
|
-
return `@font-face{font-family:"${escapeCssString(family)}";font-weight:${weight};font-style
|
|
141
|
+
return `@font-face{font-family:"${escapeCssString(family)}";font-weight:${weight};font-style:${style};src:url("${escapeCssString(faceUrl)}") format("${escapeCssString(format)}");font-display:swap;}`;
|
|
92
142
|
}
|
|
93
143
|
var escapeFontFamilyName = (fontFamily) => {
|
|
94
144
|
return fontFamily.replace(/"/g, '\\"').replace(/'/g, "\\'");
|
|
95
145
|
};
|
|
96
146
|
|
|
97
|
-
export { buildFontFaceCss, buildGoogleFontsCssUrl, describeFontFile, escapeFontFamilyName, fontFormatFromExtension, fontFormatFromMimeType, fontNameToCssVariable, fontNameToVariableName, getTypographyFonts, isKnownSymbolFontFamily, quoteFontFamily, slugifyFontFamily };
|
|
147
|
+
export { FONT_DESCRIPTOR_WORDS, FONT_STYLE_WORDS, FONT_VARIANT_WORDS, buildFontFaceCss, buildGoogleFontsCssUrl, describeFontFile, escapeFontFamilyName, fontFamilyKey, fontFormatFromExtension, fontFormatFromMimeType, fontNameToCssVariable, fontNameToVariableName, getTypographyFonts, isKnownSymbolFontFamily, normalizeFontFamilyName, quoteFontFamily, slugifyFontFamily, stripCssQuotes };
|
|
@@ -142,4 +142,8 @@ export declare function coerceNumberToString(value: string | number | null): str
|
|
|
142
142
|
*/
|
|
143
143
|
export declare function formatFileSize(byteCount: number, decimalPlaces?: number): string;
|
|
144
144
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
145
|
+
export declare function sleepWithSignal({ delayMs, signal, }: {
|
|
146
|
+
delayMs: number;
|
|
147
|
+
signal: AbortSignal | null;
|
|
148
|
+
}): Promise<unknown>;
|
|
145
149
|
export declare function errorMessage(error: unknown): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty, invariant, isEmpty, isFunction_default as isFunction, isNotNullish, isNullish, isPrimitive, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, warning } from '../../../chunk-
|
|
1
|
+
export { coerceNumberToString, deepCloneAndMergeReplacingArrays, errorMessage, exhaustiveSwitch, formatFileSize, getFromRecordOrNull, hasOwnProperty, invariant, isEmpty, isFunction_default as isFunction, isNotNullish, isNullish, isPrimitive, mergeReplacingArrays, mergeReplacingObjects, noop, preventDefault, sleep, sleepWithSignal, warning } from '../../../chunk-EXI4VDHP.mjs';
|
|
2
2
|
export { isNumber_default as isNumber, isString_default as isString } from '../../../chunk-ILGEM42C.mjs';
|
|
3
3
|
import '../../../chunk-FNTGY7I5.mjs';
|
|
4
4
|
import '../../../chunk-UJCSKKID.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isPublicHttpsUrl, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, safeHost, sanitizePublicHttpUrl, truncateDomain } from '../../../chunk-
|
|
1
|
+
export { buildUrlSearchParams, fileExtensionFromUrl, isPreviewInternalHostname, isPreviewOrigin, isPublicHttpsUrl, isValidHttpUrl, isValidRoutePath, normalizeCustomDomain, normalizeUrlIncludingProtocolRelative, normalizeUrlScheme, parseUrl, safeHost, sanitizePublicHttpUrl, truncateDomain } from '../../../chunk-DINXH6YP.mjs';
|
|
2
2
|
import '../../../chunk-AKZNN7F2.mjs';
|
|
3
3
|
import '../../../chunk-FNTGY7I5.mjs';
|
|
4
4
|
import '../../../chunk-UJCSKKID.mjs';
|
|
@@ -341,6 +341,29 @@ export declare const siteFontsSnapshotSchema: z.ZodObject<{
|
|
|
341
341
|
}, z.core.$strip>>;
|
|
342
342
|
defaultRole: z.ZodNullable<z.ZodString>;
|
|
343
343
|
}, z.core.$strip>;
|
|
344
|
+
export declare const siteDesignLibraryStateSchema: z.ZodObject<{
|
|
345
|
+
siteId: z.ZodUUID;
|
|
346
|
+
globalsCss: z.ZodNullable<z.ZodObject<{
|
|
347
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
348
|
+
selector: z.ZodString;
|
|
349
|
+
tokens: z.ZodArray<z.ZodObject<{
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
value: z.ZodString;
|
|
352
|
+
}, z.core.$strip>>;
|
|
353
|
+
}, z.core.$strip>>;
|
|
354
|
+
}, z.core.$strip>>;
|
|
355
|
+
fonts: z.ZodNullable<z.ZodObject<{
|
|
356
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
357
|
+
role: z.ZodString;
|
|
358
|
+
family: z.ZodNullable<z.ZodString>;
|
|
359
|
+
cssVar: z.ZodNullable<z.ZodString>;
|
|
360
|
+
rawValue: z.ZodString;
|
|
361
|
+
}, z.core.$strip>>;
|
|
362
|
+
defaultRole: z.ZodNullable<z.ZodString>;
|
|
363
|
+
}, z.core.$strip>>;
|
|
364
|
+
isLoading: z.ZodBoolean;
|
|
365
|
+
error: z.ZodNullable<z.ZodString>;
|
|
366
|
+
}, z.core.$strip>;
|
|
344
367
|
export declare const DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
|
|
345
368
|
export declare const designLibraryPreviewFontSchema: z.ZodObject<{
|
|
346
369
|
family: z.ZodString;
|
|
@@ -108,6 +108,13 @@ var siteFontsSnapshotSchema = z.object({
|
|
|
108
108
|
roles: z.array(siteFontRoleSchema),
|
|
109
109
|
defaultRole: z.string().nullable()
|
|
110
110
|
}).describe("SiteFontsSnapshot");
|
|
111
|
+
var siteDesignLibraryStateSchema = z.object({
|
|
112
|
+
siteId: z.uuid(),
|
|
113
|
+
globalsCss: globalsCssSnapshotSchema.nullable(),
|
|
114
|
+
fonts: siteFontsSnapshotSchema.nullable(),
|
|
115
|
+
isLoading: z.boolean(),
|
|
116
|
+
error: z.string().nullable()
|
|
117
|
+
}).describe("SiteDesignLibraryState");
|
|
111
118
|
var DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
|
|
112
119
|
var designLibraryPreviewFontSchema = z.object({
|
|
113
120
|
family: z.string(),
|
|
@@ -122,4 +129,4 @@ var designLibraryPreviewMessageSchema = z.object({
|
|
|
122
129
|
defaultFontCssVar: z.string().nullable()
|
|
123
130
|
}).describe("DesignLibraryPreviewMessage");
|
|
124
131
|
|
|
125
|
-
export { DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE, designLibraryPreviewFontSchema, designLibraryPreviewMessageSchema, designLibrarySavedStyleMetadataSchema, designLibrarySavedStylesSchema, designLibrarySchema, globalsCssScopeSchema, globalsCssSnapshotSchema, globalsCssTokenSchema, savedColorStyleSchema, savedTextStyleSchema, siteFontRoleSchema, siteFontsSnapshotSchema };
|
|
132
|
+
export { DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE, designLibraryPreviewFontSchema, designLibraryPreviewMessageSchema, designLibrarySavedStyleMetadataSchema, designLibrarySavedStylesSchema, designLibrarySchema, globalsCssScopeSchema, globalsCssSnapshotSchema, globalsCssTokenSchema, savedColorStyleSchema, savedTextStyleSchema, siteDesignLibraryStateSchema, siteFontRoleSchema, siteFontsSnapshotSchema };
|
|
@@ -59,6 +59,7 @@ export type ReploAuthenticationErrorConfig = {
|
|
|
59
59
|
type: AuthErrorType;
|
|
60
60
|
userFacingDetails?: ErrorUserFacingDetailsWithMessage;
|
|
61
61
|
additionalData?: ReploErrorConfig["additionalData"];
|
|
62
|
+
cause?: ReploErrorConfig["cause"];
|
|
62
63
|
};
|
|
63
64
|
export declare class ReploAuthenticationError extends ReploError {
|
|
64
65
|
type: AuthErrorType;
|
|
@@ -120,6 +121,13 @@ export declare class Uncommon_GloballyMappedError extends ReploError {
|
|
|
120
121
|
userFacingDetails: ErrorUserFacingDetails;
|
|
121
122
|
});
|
|
122
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* The `userFacingDetails.key` publisher puts on its 404 for a missing project.
|
|
126
|
+
* It lives here rather than next to the error class because a caller across a
|
|
127
|
+
* service boundary (airlock) matches on it to tell "this project is gone" apart
|
|
128
|
+
* from any other 404 that URL could produce.
|
|
129
|
+
*/
|
|
130
|
+
export declare const PROJECT_NOT_FOUND_ERROR_KEY = "errors.project.notFound";
|
|
123
131
|
export declare class ReploValidationError extends ReploError {
|
|
124
132
|
constructor(message: string);
|
|
125
133
|
}
|
|
@@ -429,6 +437,12 @@ export declare class IframeRpcChannelTimeoutError extends IframeRpcChannelError
|
|
|
429
437
|
timeoutMs: number;
|
|
430
438
|
});
|
|
431
439
|
}
|
|
440
|
+
export declare class IframeRpcChannelTargetUnavailableError extends IframeRpcChannelError {
|
|
441
|
+
constructor({ callType, method, }: {
|
|
442
|
+
callType: "notify" | "request" | "response";
|
|
443
|
+
method?: string;
|
|
444
|
+
});
|
|
445
|
+
}
|
|
432
446
|
export declare class IframeRpcChannelRemoteError extends IframeRpcChannelError {
|
|
433
447
|
constructor({ method, message }: {
|
|
434
448
|
method: string;
|
|
@@ -34,6 +34,17 @@ export type SelectModeBoundingRect = {
|
|
|
34
34
|
width: number;
|
|
35
35
|
height: number;
|
|
36
36
|
};
|
|
37
|
+
export type SelectModeHoverRect = {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
left: number;
|
|
41
|
+
top: number;
|
|
42
|
+
right: number;
|
|
43
|
+
bottom: number;
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
isSection?: boolean;
|
|
47
|
+
};
|
|
37
48
|
export type SelectModeSelectionRect = {
|
|
38
49
|
id: string;
|
|
39
50
|
rect: SelectModeBoundingRect;
|
|
@@ -53,16 +64,50 @@ export type SelectModeDefinedStyle = {
|
|
|
53
64
|
raw: string;
|
|
54
65
|
resolved: string;
|
|
55
66
|
};
|
|
67
|
+
export type SelectModeImageScope = {
|
|
68
|
+
kind: "all";
|
|
69
|
+
} | {
|
|
70
|
+
kind: "media";
|
|
71
|
+
media: string;
|
|
72
|
+
};
|
|
73
|
+
export type SelectModeImageSource = {
|
|
74
|
+
srcSet: string;
|
|
75
|
+
sizes: string;
|
|
76
|
+
media: string;
|
|
77
|
+
type: string;
|
|
78
|
+
previewUrl: string | null;
|
|
79
|
+
};
|
|
80
|
+
export type SelectModeImage = {
|
|
81
|
+
src: string;
|
|
82
|
+
currentSrc: string;
|
|
83
|
+
srcSet: string;
|
|
84
|
+
sizes: string;
|
|
85
|
+
previewUrl: string | null;
|
|
86
|
+
sources: SelectModeImageSource[];
|
|
87
|
+
};
|
|
88
|
+
export type SelectModeVideo = {
|
|
89
|
+
src: string;
|
|
90
|
+
currentSrc: string;
|
|
91
|
+
};
|
|
56
92
|
export type SelectedElement = {
|
|
57
93
|
kind: "react-element";
|
|
58
94
|
selector: string;
|
|
95
|
+
section?: {
|
|
96
|
+
selector: string;
|
|
97
|
+
};
|
|
59
98
|
tagName: string;
|
|
60
99
|
elementType: string;
|
|
61
100
|
textContent: string | null;
|
|
101
|
+
sectionLabel?: string;
|
|
62
102
|
rect: SelectModeBoundingRect;
|
|
63
103
|
textMetrics: SelectModeTextMetrics | null;
|
|
64
104
|
outerHTML: string;
|
|
105
|
+
image?: SelectModeImage;
|
|
106
|
+
video?: SelectModeVideo;
|
|
65
107
|
definedStyles: SelectModeDefinedStyle[];
|
|
108
|
+
authoredStyles: {
|
|
109
|
+
[x: string]: string;
|
|
110
|
+
};
|
|
66
111
|
inheritedStyles: {
|
|
67
112
|
[x: string]: string;
|
|
68
113
|
};
|
|
@@ -85,7 +130,11 @@ export type SelectablePlanPayload = {
|
|
|
85
130
|
export type SelectableDataPayload = SelectablePlanPayload;
|
|
86
131
|
export type SelectableData = SelectedElement | SelectablePlanData;
|
|
87
132
|
export type SelectModeOptimisticUpdatePayload = {
|
|
133
|
+
kind: "image";
|
|
134
|
+
image: SelectModeImage;
|
|
135
|
+
} | {
|
|
88
136
|
kind: "css";
|
|
137
|
+
fontSource?: "google" | "site";
|
|
89
138
|
property: string;
|
|
90
139
|
value: string | null;
|
|
91
140
|
} | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { SelectModeBoundingRect, DisplayMode, SelectModeSelectionType, SelectModeOptimisticUpdatePayload, SelectModeFormatCommand, SelectableData, SelectModeHoverRect, SelectModeClickPosition, SelectModeSelectionRect, SelectModeTiptapActiveMarks } from "./selectMode";
|
|
2
|
+
export type InlineEditFeedback = {
|
|
3
|
+
status: "pending" | "unavailable" | "failed";
|
|
4
|
+
rect: SelectModeBoundingRect;
|
|
5
5
|
};
|
|
6
6
|
export type IframeRuntimeBuildMetadata = {
|
|
7
7
|
packageName: string;
|
|
@@ -11,8 +11,15 @@ export type IframeRuntimeBuildMetadata = {
|
|
|
11
11
|
builtAt: string | null;
|
|
12
12
|
};
|
|
13
13
|
export type SelectModeParentMessage = {
|
|
14
|
-
method: "
|
|
15
|
-
data:
|
|
14
|
+
method: "expandToSection";
|
|
15
|
+
data: {
|
|
16
|
+
targetSelector: string;
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
method: "setSectionPreview";
|
|
20
|
+
data: {
|
|
21
|
+
targetSelector: string | null;
|
|
22
|
+
};
|
|
16
23
|
} | {
|
|
17
24
|
method: "setDisplayMode";
|
|
18
25
|
data: {
|
|
@@ -70,7 +77,7 @@ export type SelectModeIframeMessage = {
|
|
|
70
77
|
} | {
|
|
71
78
|
method: "hoverElement";
|
|
72
79
|
data: {
|
|
73
|
-
rect:
|
|
80
|
+
rect: SelectModeHoverRect | null;
|
|
74
81
|
};
|
|
75
82
|
} | {
|
|
76
83
|
method: "selectedElementRectUpdate";
|
|
@@ -105,11 +112,17 @@ export type SelectModeIframeMessage = {
|
|
|
105
112
|
};
|
|
106
113
|
originalInnerHTML: string;
|
|
107
114
|
};
|
|
115
|
+
} | {
|
|
116
|
+
method: "inlineEditFeedbackChanged";
|
|
117
|
+
data: {
|
|
118
|
+
feedback: InlineEditFeedback | null;
|
|
119
|
+
};
|
|
108
120
|
} | {
|
|
109
121
|
method: "editorStateUpdate";
|
|
110
122
|
data: {
|
|
111
123
|
activeMarks: SelectModeTiptapActiveMarks;
|
|
112
|
-
|
|
124
|
+
isInlineEditing: boolean;
|
|
125
|
+
isInlineEditPending: boolean;
|
|
113
126
|
};
|
|
114
127
|
} | {
|
|
115
128
|
method: "fastRefreshComplete";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IframeRpcChannelConfigurationError, IframeRpcChannelUnsubscribedError, IframeRpcChannelUnknownMethodError, IframeRpcChannelInvalidInputError, randomUUID, IframeRpcChannelTimeoutError, IframeRpcChannelRemoteError } from '../../chunk-
|
|
2
|
-
import { isNullish } from '../../chunk-
|
|
1
|
+
import { IframeRpcChannelConfigurationError, IframeRpcChannelUnsubscribedError, IframeRpcChannelUnknownMethodError, IframeRpcChannelInvalidInputError, IframeRpcChannelTargetUnavailableError, randomUUID, IframeRpcChannelTimeoutError, IframeRpcChannelRemoteError } from '../../chunk-VUXOGD76.mjs';
|
|
2
|
+
import { isNullish } from '../../chunk-EXI4VDHP.mjs';
|
|
3
3
|
import '../../chunk-ILGEM42C.mjs';
|
|
4
4
|
import '../../chunk-FNTGY7I5.mjs';
|
|
5
5
|
import '../../chunk-UJCSKKID.mjs';
|
|
@@ -102,8 +102,8 @@ function createIframeRpcChannel(options) {
|
|
|
102
102
|
const pendingRequests = /* @__PURE__ */ new Map();
|
|
103
103
|
let subscriberCount = 0;
|
|
104
104
|
let handlerMeta;
|
|
105
|
-
const postMessage = (call2) => {
|
|
106
|
-
|
|
105
|
+
const postMessage = (call2, targetWindow = getTargetWindow()) => {
|
|
106
|
+
targetWindow?.postMessage(
|
|
107
107
|
{
|
|
108
108
|
channelIdentifier,
|
|
109
109
|
version,
|
|
@@ -223,9 +223,6 @@ function createIframeRpcChannel(options) {
|
|
|
223
223
|
pendingRequest.resolve(parsedOutput.data);
|
|
224
224
|
};
|
|
225
225
|
const handleMessage = (event) => {
|
|
226
|
-
if (!isExpectedMessage(event)) {
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
226
|
const parsedMetadata = z.object({
|
|
230
227
|
channelIdentifier: z.literal(channelIdentifier),
|
|
231
228
|
version: z.literal(version)
|
|
@@ -233,6 +230,15 @@ function createIframeRpcChannel(options) {
|
|
|
233
230
|
if (!parsedMetadata.success) {
|
|
234
231
|
return;
|
|
235
232
|
}
|
|
233
|
+
if (!isExpectedMessage(event)) {
|
|
234
|
+
defaultLogger.error("[iframeRpcChannel] Dropping unexpected message", {
|
|
235
|
+
channelIdentifier,
|
|
236
|
+
version,
|
|
237
|
+
origin: event.origin,
|
|
238
|
+
hasSource: Boolean(event.source)
|
|
239
|
+
});
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
236
242
|
const parsedCall = iframeRpcCallSchema.safeParse(event.data);
|
|
237
243
|
if (!parsedCall.success) {
|
|
238
244
|
return;
|
|
@@ -319,6 +325,15 @@ function createIframeRpcChannel(options) {
|
|
|
319
325
|
new IframeRpcChannelUnsubscribedError({ method })
|
|
320
326
|
);
|
|
321
327
|
}
|
|
328
|
+
const targetWindow = getTargetWindow();
|
|
329
|
+
if (!targetWindow) {
|
|
330
|
+
return Promise.reject(
|
|
331
|
+
new IframeRpcChannelTargetUnavailableError({
|
|
332
|
+
callType: "request",
|
|
333
|
+
method
|
|
334
|
+
})
|
|
335
|
+
);
|
|
336
|
+
}
|
|
322
337
|
const id = randomUUID();
|
|
323
338
|
const timeoutMs = definition.timeoutMs ?? 3e4;
|
|
324
339
|
return new Promise(
|
|
@@ -335,12 +350,21 @@ function createIframeRpcChannel(options) {
|
|
|
335
350
|
reject,
|
|
336
351
|
timeoutId
|
|
337
352
|
});
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
353
|
+
try {
|
|
354
|
+
postMessage(
|
|
355
|
+
{
|
|
356
|
+
type: "request",
|
|
357
|
+
id,
|
|
358
|
+
method,
|
|
359
|
+
data: parsedInput.data
|
|
360
|
+
},
|
|
361
|
+
targetWindow
|
|
362
|
+
);
|
|
363
|
+
} catch (error) {
|
|
364
|
+
clearTimeout(timeoutId);
|
|
365
|
+
pendingRequests.delete(id);
|
|
366
|
+
reject(error);
|
|
367
|
+
}
|
|
344
368
|
}
|
|
345
369
|
);
|
|
346
370
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../chunk-UJCSKKID.mjs';
|
|
2
2
|
|
|
3
|
-
var migrationCommand = `pnpm add
|
|
4
|
-
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove
|
|
3
|
+
var migrationCommand = `pnpm add @replohq/sdk@latest @replohq/sandbox-runtime@latest && pnpm remove canopy-sdk
|
|
4
|
+
(if package.json lists "@replohq/canopy-sdk" instead of the "canopy-sdk" alias, run: pnpm remove @replohq/canopy-sdk)`;
|
|
5
5
|
var providerComposition = `import { ReploProvider } from "@replohq/sdk/providers/replo-provider";
|
|
6
6
|
import { SandboxRuntime } from "@replohq/sandbox-runtime";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReploError } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
import { ReploError } from '../../chunk-VUXOGD76.mjs';
|
|
2
|
+
import '../../chunk-EXI4VDHP.mjs';
|
|
3
3
|
import '../../chunk-ILGEM42C.mjs';
|
|
4
4
|
import '../../chunk-FNTGY7I5.mjs';
|
|
5
5
|
import { __commonJS, __toESM } from '../../chunk-UJCSKKID.mjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
|
|
2
|
-
import { parseUrl } from '../../../chunk-
|
|
2
|
+
import { parseUrl } from '../../../chunk-DINXH6YP.mjs';
|
|
3
3
|
import '../../../chunk-AKZNN7F2.mjs';
|
|
4
|
-
import { ReploError } from '../../../chunk-
|
|
5
|
-
import '../../../chunk-
|
|
4
|
+
import { ReploError } from '../../../chunk-VUXOGD76.mjs';
|
|
5
|
+
import '../../../chunk-EXI4VDHP.mjs';
|
|
6
6
|
import '../../../chunk-ILGEM42C.mjs';
|
|
7
7
|
import '../../../chunk-FNTGY7I5.mjs';
|
|
8
8
|
import '../../../chunk-UJCSKKID.mjs';
|