@replohq/sandbox-runtime 1.16.2 → 1.17.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.
Files changed (30) hide show
  1. package/_vendor/replo-utils/lib/historyKeys.d.ts +2 -0
  2. package/_vendor/replo-utils/lib/historyKeys.mjs +18 -0
  3. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
  4. package/_vendor/schemas/selectModeIframeRpc.d.ts +146 -0
  5. package/_vendor/schemas/selectModeIframeRpc.mjs +72 -2
  6. package/buildMetadata.js +3 -3
  7. package/package.json +4 -4
  8. package/select-mode/EditorSelection.js +5 -1
  9. package/select-mode/fast-refresh-relay.js +82 -3
  10. package/select-mode/fiber.d.ts +6 -0
  11. package/select-mode/fiber.js +33 -0
  12. package/select-mode/hooks/useParentMessaging.js +10 -3
  13. package/select-mode/hooks/useSelectionHover.js +2 -1
  14. package/select-mode/hooks/useSelectionInteractions.js +10 -0
  15. package/select-mode/iframeRpcChannel.d.ts +45 -1
  16. package/select-mode/iframeRpcChannel.js +7 -0
  17. package/select-mode/section-canvas/SectionCanvas.d.ts +7 -0
  18. package/select-mode/section-canvas/SectionCanvas.js +599 -0
  19. package/select-mode/section-canvas/optimisticSectionMove.d.ts +39 -0
  20. package/select-mode/section-canvas/optimisticSectionMove.js +172 -0
  21. package/select-mode/section-canvas/sectionCanvasControls.d.ts +3 -0
  22. package/select-mode/section-canvas/sectionCanvasControls.js +8 -0
  23. package/select-mode/section-canvas/sectionCanvasStore.d.ts +71 -0
  24. package/select-mode/section-canvas/sectionCanvasStore.js +275 -0
  25. package/select-mode/section-canvas/sectionElements.d.ts +16 -0
  26. package/select-mode/section-canvas/sectionElements.js +94 -0
  27. package/select-mode/section-canvas/sectionGhost.d.ts +5 -0
  28. package/select-mode/section-canvas/sectionGhost.js +23 -0
  29. package/select-mode/symbolicate.d.ts +2 -0
  30. package/select-mode/symbolicate.js +18 -1
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ async function captureSectionGhost({
3
+ elements,
4
+ width
5
+ }) {
6
+ const element = elements.find((candidate) => candidate.isConnected);
7
+ if (!element) {
8
+ return null;
9
+ }
10
+ const rect = element.getBoundingClientRect();
11
+ if (rect.width === 0 || rect.height === 0) {
12
+ return null;
13
+ }
14
+ try {
15
+ const { snapdom } = await import("@zumer/snapdom");
16
+ return await snapdom.toRaw(element, { width, embedFonts: false });
17
+ } catch {
18
+ return null;
19
+ }
20
+ }
21
+ export {
22
+ captureSectionGhost
23
+ };
@@ -1,4 +1,6 @@
1
1
  import type { SelectedElement, SelectModeSourceLocation } from "../_vendor/schemas/generated/selectMode";
2
2
  export declare function invalidateSymbolicationCache(): void;
3
+ /** Resolves compiled locations to original files in one batched request; unresolved ones come back unchanged. */
4
+ export declare function symbolicateSourceLocations(locations: readonly SelectModeSourceLocation[]): Promise<SelectModeSourceLocation[]>;
3
5
  export declare function isUserSourceLocation(location: SelectModeSourceLocation | undefined): boolean;
4
6
  export declare function symbolicateSelectedElement(selectedElement: SelectedElement): Promise<SelectedElement>;
@@ -190,6 +190,22 @@ function applyResolved({
190
190
  componentName: original.componentName
191
191
  };
192
192
  }
193
+ async function symbolicateSourceLocations(locations) {
194
+ const compiledIndices = locations.flatMap((location, index) => {
195
+ return isLikelyCompiledLocation(location) ? [index] : [];
196
+ });
197
+ const resolved = await symbolicateFrames(
198
+ compiledIndices.map((index) => toNextStackFrame(locations[index]))
199
+ );
200
+ const result = [...locations];
201
+ for (const [position, index] of compiledIndices.entries()) {
202
+ result[index] = applyResolved({
203
+ original: locations[index],
204
+ frame: extractResolvedFrame(resolved[position] ?? null)
205
+ });
206
+ }
207
+ return result;
208
+ }
193
209
  function isUserSourceLocation(location) {
194
210
  return Boolean(
195
211
  location && !isLikelyCompiledLocation(location) && !isDependencyOrInternalPath(location.filePath)
@@ -245,5 +261,6 @@ async function symbolicateSelectedElement(selectedElement) {
245
261
  export {
246
262
  invalidateSymbolicationCache,
247
263
  isUserSourceLocation,
248
- symbolicateSelectedElement
264
+ symbolicateSelectedElement,
265
+ symbolicateSourceLocations
249
266
  };