@replohq/sandbox-runtime 1.16.2 → 1.18.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.js +26 -0
- package/DocumentReadyBeacon.js +5 -1
- package/_vendor/replo-utils/lib/historyKeys.d.ts +2 -0
- package/_vendor/replo-utils/lib/historyKeys.mjs +18 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
- package/_vendor/schemas/iframeRpcChannel.mjs +3 -541
- package/_vendor/schemas/previewHealthIframeRpc.d.ts +159 -0
- package/_vendor/schemas/previewHealthIframeRpc.mjs +123 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +149 -3
- package/_vendor/schemas/selectModeIframeRpc.mjs +72 -2
- package/buildMetadata.js +3 -3
- package/chunk-KRA4LUIR.mjs +541 -0
- package/nextErrorFeed.d.ts +30 -0
- package/nextErrorFeed.js +64 -0
- package/package.json +5 -12
- package/previewHealth.d.ts +25 -0
- package/previewHealth.js +431 -0
- package/sandbox-runtime.js +0 -2
- package/select-mode/EditorSelection.js +5 -1
- package/select-mode/fast-refresh-relay.js +82 -3
- package/select-mode/fiber.d.ts +6 -0
- package/select-mode/fiber.js +33 -0
- package/select-mode/hooks/useParentMessaging.js +10 -3
- package/select-mode/hooks/useSelectionHover.js +2 -1
- package/select-mode/hooks/useSelectionInteractions.js +10 -0
- package/select-mode/iframeRpcChannel.d.ts +46 -2
- package/select-mode/iframeRpcChannel.js +7 -0
- package/select-mode/section-canvas/SectionCanvas.d.ts +7 -0
- package/select-mode/section-canvas/SectionCanvas.js +599 -0
- package/select-mode/section-canvas/optimisticSectionMove.d.ts +39 -0
- package/select-mode/section-canvas/optimisticSectionMove.js +172 -0
- package/select-mode/section-canvas/sectionCanvasControls.d.ts +3 -0
- package/select-mode/section-canvas/sectionCanvasControls.js +8 -0
- package/select-mode/section-canvas/sectionCanvasStore.d.ts +71 -0
- package/select-mode/section-canvas/sectionCanvasStore.js +275 -0
- package/select-mode/section-canvas/sectionElements.d.ts +16 -0
- package/select-mode/section-canvas/sectionElements.js +94 -0
- package/select-mode/section-canvas/sectionGhost.d.ts +5 -0
- package/select-mode/section-canvas/sectionGhost.js +23 -0
- package/select-mode/symbolicate.d.ts +2 -0
- package/select-mode/symbolicate.js +18 -1
- package/NextErrorReporter.d.ts +0 -1
- package/NextErrorReporter.js +0 -131
- package/_vendor/schemas/componentPreview.d.ts +0 -43
- package/_vendor/schemas/componentPreview.mjs +0 -79
- package/_vendor/schemas/generated/componentPreview.d.ts +0 -5
- package/_vendor/schemas/generated/componentPreview.mjs +0 -1
- package/_vendor/schemas/loaderKeys.d.ts +0 -69
- package/next/component-preview-client.d.ts +0 -8
- package/next/component-preview-client.js +0 -227
- package/next/component-preview-href.d.ts +0 -5
- package/next/component-preview-href.js +0 -13
- package/next/component-preview-props.d.ts +0 -8
- package/next/component-preview-props.js +0 -35
- package/next/component-preview.d.ts +0 -11
- package/next/component-preview.js +0 -83
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
componentPreviewProductReferenceSchema,
|
|
4
|
-
componentPreviewPropsSchema,
|
|
5
|
-
MAX_COMPONENT_PREVIEW_PROPS_BYTES
|
|
6
|
-
} from "../_vendor/schemas/componentPreview.mjs";
|
|
7
|
-
import { DocumentReadyBeacon } from "../DocumentReadyBeacon";
|
|
8
|
-
import { NextErrorReporter } from "../NextErrorReporter";
|
|
9
|
-
import {
|
|
10
|
-
ComponentPreviewNavigation,
|
|
11
|
-
ComponentPreviewStage
|
|
12
|
-
} from "./component-preview-client";
|
|
13
|
-
async function getPreviewProps({
|
|
14
|
-
value,
|
|
15
|
-
getProduct
|
|
16
|
-
}) {
|
|
17
|
-
const previewPropsResult = componentPreviewPropsSchema.safeParse(value);
|
|
18
|
-
if (!previewPropsResult.success) {
|
|
19
|
-
return { rawProps: {}, resolvedProps: {} };
|
|
20
|
-
}
|
|
21
|
-
const rawProps = {};
|
|
22
|
-
const resolvedProps = {};
|
|
23
|
-
for (const [name, propValue] of Object.entries(previewPropsResult.data)) {
|
|
24
|
-
rawProps[name] = propValue;
|
|
25
|
-
const productReferenceResult = componentPreviewProductReferenceSchema.safeParse(propValue);
|
|
26
|
-
if (!productReferenceResult.success) {
|
|
27
|
-
resolvedProps[name] = propValue;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
resolvedProps[name] = getProduct ? await getProduct(productReferenceResult.data) : propValue;
|
|
31
|
-
}
|
|
32
|
-
return { rawProps, resolvedProps };
|
|
33
|
-
}
|
|
34
|
-
async function parseProps({
|
|
35
|
-
value,
|
|
36
|
-
getProduct
|
|
37
|
-
}) {
|
|
38
|
-
if (typeof value !== "string" || new TextEncoder().encode(value).byteLength > MAX_COMPONENT_PREVIEW_PROPS_BYTES) {
|
|
39
|
-
return { rawProps: {}, resolvedProps: {} };
|
|
40
|
-
}
|
|
41
|
-
let parsed;
|
|
42
|
-
try {
|
|
43
|
-
parsed = JSON.parse(value);
|
|
44
|
-
} catch {
|
|
45
|
-
return { rawProps: {}, resolvedProps: {} };
|
|
46
|
-
}
|
|
47
|
-
return await getPreviewProps({ value: parsed, getProduct });
|
|
48
|
-
}
|
|
49
|
-
function createComponentPreviewPage(Component, options) {
|
|
50
|
-
return async function ComponentPreviewPage({
|
|
51
|
-
searchParams
|
|
52
|
-
}) {
|
|
53
|
-
const resolvedSearchParams = await searchParams;
|
|
54
|
-
const { rawProps, resolvedProps } = await parseProps({
|
|
55
|
-
value: resolvedSearchParams.props,
|
|
56
|
-
getProduct: options?.getProduct
|
|
57
|
-
});
|
|
58
|
-
if (options?.interactive) {
|
|
59
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(DocumentReadyBeacon, {}),
|
|
61
|
-
/* @__PURE__ */ jsx(NextErrorReporter, {}),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
ComponentPreviewStage,
|
|
64
|
-
{
|
|
65
|
-
Component,
|
|
66
|
-
initialProps: resolvedProps,
|
|
67
|
-
initialRawProps: rawProps,
|
|
68
|
-
initialSourceRevision: typeof resolvedSearchParams.sourceRevision === "string" ? resolvedSearchParams.sourceRevision : ""
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
] });
|
|
72
|
-
}
|
|
73
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */ jsx(ComponentPreviewNavigation, {}),
|
|
75
|
-
/* @__PURE__ */ jsx(DocumentReadyBeacon, {}),
|
|
76
|
-
/* @__PURE__ */ jsx(NextErrorReporter, {}),
|
|
77
|
-
/* @__PURE__ */ jsx("div", { "data-replo-component-preview": true, style: { display: "flow-root" }, children: /* @__PURE__ */ jsx(Component, { ...resolvedProps }) })
|
|
78
|
-
] });
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
export {
|
|
82
|
-
createComponentPreviewPage
|
|
83
|
-
};
|