@replohq/canopy-sdk 0.4.1 → 0.6.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/_vendor/replo-utils/lib/geometry.d.ts +18 -0
- package/_vendor/replo-utils/lib/geometry.mjs +9 -0
- package/_vendor/replo-utils/lib/misc.d.ts +8 -8
- package/_vendor/replo-utils/lib/misc.mjs +1 -1
- package/_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs +1 -1
- package/_vendor/schemas/errors.d.ts +1 -1
- package/_vendor/schemas/errors.mjs +7 -3
- package/_vendor/schemas/generated/selectMode.d.ts +8 -2
- package/_vendor/schemas/objectType.d.ts +2 -0
- package/_vendor/schemas/objectType.mjs +1 -1
- package/_vendor/schemas/registry.d.ts +283 -9
- package/_vendor/schemas/selectMode.d.ts +41 -2
- package/_vendor/schemas/selectMode.mjs +13 -4
- package/{chunk-XK2K3263.mjs → chunk-MSIQX4QA.mjs} +9 -7
- package/{chunk-7WEM5FUJ.mjs → chunk-ZLOHRRSZ.mjs} +118 -3
- package/consent/consent-actions.d.ts +6 -0
- package/consent/consent-actions.js +1 -2
- package/consent/consent-actions.js.map +2 -2
- package/consent/consent-store.d.ts +19 -4
- package/consent/consent-store.js +32 -12
- package/consent/consent-store.js.map +2 -2
- package/consent/cookie.js +5 -10
- package/consent/cookie.js.map +2 -2
- package/consent/types.d.ts +5 -0
- package/consent/window-api.js +1 -1
- package/consent/window-api.js.map +2 -2
- package/editor/ClientErrorBoundary.d.ts +6 -3
- package/editor/ClientErrorBoundary.js +18 -5
- package/editor/ClientErrorBoundary.js.map +2 -2
- package/editor/LinkInterceptor.js +5 -5
- package/editor/LinkInterceptor.js.map +2 -2
- package/editor/NextErrorReporter.d.ts +1 -0
- package/editor/NextErrorReporter.js +63 -0
- package/editor/NextErrorReporter.js.map +7 -0
- package/editor/select-mode/hooks/useSelectModeController.js +2 -1
- package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionInteractions.d.ts +3 -3
- package/editor/select-mode/hooks/useSelectionInteractions.js +54 -16
- package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
- package/editor/select-mode/interactions/selectionGeometry.d.ts +37 -12
- package/editor/select-mode/interactions/selectionGeometry.js +52 -24
- package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
- package/editor/select-mode/selectionFrame.d.ts +26 -7
- package/editor/select-mode/selectionFrame.js +58 -34
- package/editor/select-mode/selectionFrame.js.map +2 -2
- package/editor/select-mode/symbolicate.js +32 -1
- package/editor/select-mode/symbolicate.js.map +2 -2
- package/package.json +1 -1
- package/providers/replo-provider.js +11 -7
- package/providers/replo-provider.js.map +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isIntersecting, isRectEnclosing } from "../../../_vendor/replo-utils/lib/geometry.mjs";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
1
3
|
const SELECTION_TOLERANCE_PX = 4;
|
|
2
4
|
function normalizeSelectionRect({
|
|
3
5
|
startX,
|
|
@@ -81,48 +83,72 @@ function getViewportRectFromPageRect({
|
|
|
81
83
|
bottom: rect.bottom - scrollOffset.top
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
|
-
function isMeaningfulElement(element) {
|
|
86
|
+
function isMeaningfulElement(element, elementRect) {
|
|
85
87
|
const tagName = element.tagName.toLowerCase();
|
|
86
88
|
if (["html", "body", "script", "style", "meta", "link"].includes(tagName)) {
|
|
87
89
|
return false;
|
|
88
90
|
}
|
|
89
|
-
const elementRect = element.getBoundingClientRect();
|
|
90
91
|
if (elementRect.width < 4 || elementRect.height < 4) {
|
|
91
92
|
return false;
|
|
92
93
|
}
|
|
93
94
|
return true;
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
+
function doesRectIntersectSelection({
|
|
96
97
|
elementRect,
|
|
97
98
|
selectionRect,
|
|
98
99
|
tolerancePx
|
|
99
100
|
}) {
|
|
100
|
-
return elementRect
|
|
101
|
+
return isIntersecting(elementRect, selectionRect, { tolerance: tolerancePx }) && !isRectEnclosing(elementRect, selectionRect);
|
|
101
102
|
}
|
|
102
|
-
function
|
|
103
|
-
const candidates =
|
|
104
|
-
|
|
103
|
+
function collectDragCandidates(scrollOffset) {
|
|
104
|
+
const candidates = [];
|
|
105
|
+
for (const element of Array.from(document.querySelectorAll("*"))) {
|
|
106
|
+
const viewportRect = getElementBoundingRect(element);
|
|
107
|
+
if (!isMeaningfulElement(element, viewportRect)) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
candidates.push({
|
|
111
|
+
id: uuidv4(),
|
|
105
112
|
element,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
elementRect,
|
|
111
|
-
selectionRect,
|
|
112
|
-
tolerancePx: SELECTION_TOLERANCE_PX
|
|
113
|
+
pageRect: getPageRectFromViewportRect({
|
|
114
|
+
rect: viewportRect,
|
|
115
|
+
scrollOffset
|
|
116
|
+
})
|
|
113
117
|
});
|
|
118
|
+
}
|
|
119
|
+
return candidates;
|
|
120
|
+
}
|
|
121
|
+
function collapseFullyCoveredChildren({
|
|
122
|
+
candidates,
|
|
123
|
+
selected
|
|
124
|
+
}) {
|
|
125
|
+
const candidateElements = new Set(
|
|
126
|
+
candidates.map((candidate) => candidate.element)
|
|
127
|
+
);
|
|
128
|
+
const selectedElements = new Set(
|
|
129
|
+
selected.map((candidate) => candidate.element)
|
|
130
|
+
);
|
|
131
|
+
return selected.filter((candidate) => {
|
|
132
|
+
const parent = candidate.element.parentElement;
|
|
133
|
+
if (!parent || !selectedElements.has(parent)) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
const everyCandidateChildSelected = Array.from(parent.children).filter((child) => candidateElements.has(child)).every((child) => selectedElements.has(child));
|
|
137
|
+
return !everyCandidateChildSelected;
|
|
114
138
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
}
|
|
140
|
+
function getCandidatesInSelection({
|
|
141
|
+
candidates,
|
|
142
|
+
selectionPageRect
|
|
143
|
+
}) {
|
|
144
|
+
const intersecting = candidates.filter((candidate) => {
|
|
145
|
+
return doesRectIntersectSelection({
|
|
146
|
+
elementRect: candidate.pageRect,
|
|
147
|
+
selectionRect: selectionPageRect,
|
|
148
|
+
tolerancePx: SELECTION_TOLERANCE_PX
|
|
122
149
|
});
|
|
123
|
-
}).map(({ element }) => {
|
|
124
|
-
return element;
|
|
125
150
|
});
|
|
151
|
+
return collapseFullyCoveredChildren({ candidates, selected: intersecting });
|
|
126
152
|
}
|
|
127
153
|
function getElementAnchor({
|
|
128
154
|
element,
|
|
@@ -148,11 +174,13 @@ function getElementBoundingRect(element) {
|
|
|
148
174
|
};
|
|
149
175
|
}
|
|
150
176
|
export {
|
|
177
|
+
collectDragCandidates,
|
|
178
|
+
doesRectIntersectSelection,
|
|
179
|
+
getCandidatesInSelection,
|
|
151
180
|
getDocumentScrollOffset,
|
|
152
181
|
getDragPositionFromClient,
|
|
153
182
|
getElementAnchor,
|
|
154
183
|
getElementBoundingRect,
|
|
155
|
-
getElementsInRect,
|
|
156
184
|
getPageRectFromViewportRect,
|
|
157
185
|
getViewportRectFromPageRect,
|
|
158
186
|
getViewportSelectionRect
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../editor/select-mode/interactions/selectionGeometry.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n SelectModeBoundingRect,\n SelectModeClickPosition,\n} from \"schemas/generated/selectMode\";\n\nexport type DragPosition = {\n clientX: number;\n clientY: number;\n pageX: number;\n pageY: number;\n};\n\nexport type ScrollOffset = {\n left: number;\n top: number;\n};\n\nexport type SelectedAreaState = {\n pageRect: SelectModeBoundingRect;\n};\n\n// NOTE (
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type {\n SelectModeBoundingRect,\n SelectModeClickPosition,\n} from \"schemas/generated/selectMode\";\n\nimport { isIntersecting, isRectEnclosing } from \"replo-utils/lib/geometry\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport type DragPosition = {\n clientX: number;\n clientY: number;\n pageX: number;\n pageY: number;\n};\n\nexport type ScrollOffset = {\n left: number;\n top: number;\n};\n\nexport type SelectedAreaState = {\n pageRect: SelectModeBoundingRect;\n};\n\n// NOTE (Noah, 2026-04-21): A small fudge factor so elements\n// that visually appear to touch the selection rect (but whose bounding\n// box is a pixel or two off due to borders/sub-pixel rendering) still get\n// included.\nconst SELECTION_TOLERANCE_PX = 4;\n\nfunction normalizeSelectionRect({\n startX,\n startY,\n endX,\n endY,\n}: {\n startX: number;\n startY: number;\n endX: number;\n endY: number;\n}): SelectModeBoundingRect {\n const left = Math.min(startX, endX);\n const right = Math.max(startX, endX);\n const top = Math.min(startY, endY);\n const bottom = Math.max(startY, endY);\n\n return {\n x: left,\n y: top,\n width: right - left,\n height: bottom - top,\n top,\n right,\n bottom,\n left,\n };\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getDragPositionFromClient({\n clientX,\n clientY,\n scrollOffset,\n}: {\n clientX: number;\n clientY: number;\n scrollOffset: ScrollOffset;\n}): DragPosition {\n return {\n clientX,\n clientY,\n pageX: clientX + scrollOffset.left,\n pageY: clientY + scrollOffset.top,\n };\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getDocumentScrollOffset(): ScrollOffset {\n const scrollingElement = document.scrollingElement;\n return {\n left: scrollingElement?.scrollLeft ?? window.scrollX,\n top: scrollingElement?.scrollTop ?? window.scrollY,\n };\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getViewportSelectionRect({\n dragStart,\n dragCurrent,\n scrollOffset,\n}: {\n dragStart: DragPosition;\n dragCurrent: DragPosition;\n scrollOffset: ScrollOffset;\n}): SelectModeBoundingRect {\n return normalizeSelectionRect({\n startX: dragStart.pageX - scrollOffset.left,\n startY: dragStart.pageY - scrollOffset.top,\n endX: dragCurrent.pageX - scrollOffset.left,\n endY: dragCurrent.pageY - scrollOffset.top,\n });\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getPageRectFromViewportRect({\n rect,\n scrollOffset,\n}: {\n rect: SelectModeBoundingRect;\n scrollOffset: ScrollOffset;\n}): SelectModeBoundingRect {\n return {\n x: rect.x + scrollOffset.left,\n y: rect.y + scrollOffset.top,\n width: rect.width,\n height: rect.height,\n left: rect.left + scrollOffset.left,\n top: rect.top + scrollOffset.top,\n right: rect.right + scrollOffset.left,\n bottom: rect.bottom + scrollOffset.top,\n };\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getViewportRectFromPageRect({\n rect,\n scrollOffset,\n}: {\n rect: SelectModeBoundingRect;\n scrollOffset: ScrollOffset;\n}): SelectModeBoundingRect {\n return {\n x: rect.x - scrollOffset.left,\n y: rect.y - scrollOffset.top,\n width: rect.width,\n height: rect.height,\n left: rect.left - scrollOffset.left,\n top: rect.top - scrollOffset.top,\n right: rect.right - scrollOffset.left,\n bottom: rect.bottom - scrollOffset.top,\n };\n}\n\nfunction isMeaningfulElement(\n element: Element,\n elementRect: SelectModeBoundingRect,\n): boolean {\n const tagName = element.tagName.toLowerCase();\n if ([\"html\", \"body\", \"script\", \"style\", \"meta\", \"link\"].includes(tagName)) {\n return false;\n }\n\n if (elementRect.width < 4 || elementRect.height < 4) {\n return false;\n }\n\n return true;\n}\n\n/**\n * A drag captures an element when their boxes overlap (within\n * `tolerancePx`) \u2014 but NOT when the drag sits entirely inside the\n * element. The latter case is the user dragging *within* a large\n * container (a section, `<main>`, `<body>`) to lasso its children; the\n * container itself isn't a thing they're trying to select, so we drop it.\n */\nexport function doesRectIntersectSelection({\n elementRect,\n selectionRect,\n tolerancePx,\n}: {\n elementRect: SelectModeBoundingRect;\n selectionRect: SelectModeBoundingRect;\n tolerancePx: number;\n}) {\n return (\n isIntersecting(elementRect, selectionRect, { tolerance: tolerancePx }) &&\n !isRectEnclosing(elementRect, selectionRect)\n );\n}\n\n// A meaningful element plus its page-coordinate rect and a stable id,\n// snapshotted once when a drag begins. Page coordinates are scroll-\n// invariant, so per-move hit-testing never needs to re-measure.\nexport type DragCandidate = {\n id: string;\n element: Element;\n pageRect: SelectModeBoundingRect;\n};\n\n/**\n * Snapshots every meaningful element and its page rect when a drag begins.\n * Each candidate gets a stable id so the parent overlay can key its\n * live highlights without remounting them as the drag moves.\n */\nexport function collectDragCandidates(\n scrollOffset: ScrollOffset,\n): DragCandidate[] {\n const candidates: DragCandidate[] = [];\n for (const element of Array.from(document.querySelectorAll(\"*\"))) {\n const viewportRect = getElementBoundingRect(element);\n if (!isMeaningfulElement(element, viewportRect)) {\n continue;\n }\n candidates.push({\n id: uuidv4(),\n element,\n pageRect: getPageRectFromViewportRect({\n rect: viewportRect,\n scrollOffset,\n }),\n });\n }\n return candidates;\n}\n\n/**\n * Drop a child whose parent is also selected and every one of that\n * parent's *candidate* children is selected: the parent already represents\n * the whole group, so the children are redundant. Returns only the\n * candidates that survive the collapse.\n *\n * Only children that are themselves drag candidates count toward \"fully\n * covered\". A parent's DOM children can include decorative / non-selectable\n * elements (and `.children` excludes text nodes); those can never be\n * selected, so counting them would wedge the check permanently false and\n * the collapse would never fire.\n *\n * Membership is read once up front, so the collapse cascades up the tree\n * in a single pass \u2014 a parent kept this round is itself dropped when *its*\n * parent is likewise fully covered, leaving only the topmost ancestor of\n * any fully-enclosed subtree.\n */\nfunction collapseFullyCoveredChildren({\n candidates,\n selected,\n}: {\n candidates: DragCandidate[];\n selected: DragCandidate[];\n}): DragCandidate[] {\n const candidateElements = new Set(\n candidates.map((candidate) => candidate.element),\n );\n const selectedElements = new Set(\n selected.map((candidate) => candidate.element),\n );\n return selected.filter((candidate) => {\n const parent = candidate.element.parentElement;\n if (!parent || !selectedElements.has(parent)) {\n return true;\n }\n const everyCandidateChildSelected = Array.from(parent.children)\n .filter((child) => candidateElements.has(child))\n .every((child) => selectedElements.has(child));\n return !everyCandidateChildSelected;\n });\n}\n\n/**\n * Cheap per-move hit-test against the pre-collected candidates: keep the\n * ones whose page rect overlaps the selection (excluding any that wholly\n * enclose it), then collapse any fully-covered parent/children group down\n * to just the parent (see `collapseFullyCoveredChildren`). Does no DOM\n * queries or re-measures of geometry \u2014 the only DOM reads are cheap\n * parent/child structural lookups.\n *\n * Because the collapse depends on which siblings are currently captured,\n * elements legitimately move in and out of the result as the drag grows or\n * shrinks: a child drops out the moment the drag swallows its last sibling\n * (the parent takes over), and reappears if the drag retreats.\n */\nexport function getCandidatesInSelection({\n candidates,\n selectionPageRect,\n}: {\n candidates: DragCandidate[];\n selectionPageRect: SelectModeBoundingRect;\n}): DragCandidate[] {\n const intersecting = candidates.filter((candidate) => {\n return doesRectIntersectSelection({\n elementRect: candidate.pageRect,\n selectionRect: selectionPageRect,\n tolerancePx: SELECTION_TOLERANCE_PX,\n });\n });\n\n return collapseFullyCoveredChildren({ candidates, selected: intersecting });\n}\n\n/**\n * Picks a \"click position\" for an element that fell inside an area\n * selection. We use the corner of the element nearest the top-left of the\n * selection rect, clamped to the element's own bounds. This anchor is what\n * lets the selected-element overlay continue to track the element when the\n * user scrolls (`useSelectionScrollSync` re-projects relative to it).\n *\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getElementAnchor({\n element,\n selectionRect,\n}: {\n element: Element;\n selectionRect: SelectModeBoundingRect;\n}): SelectModeClickPosition {\n const rect = element.getBoundingClientRect();\n\n return {\n x: Math.min(Math.max(selectionRect.left, rect.left), rect.right),\n y: Math.min(Math.max(selectionRect.top, rect.top), rect.bottom),\n };\n}\n\n/**\n * @author Kevin O'Connell 2026-04-17\n */\nexport function getElementBoundingRect(\n element: Element,\n): SelectModeBoundingRect {\n const rect = element.getBoundingClientRect();\n\n return {\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n top: rect.top,\n right: rect.right,\n bottom: r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AAK,KAAK,GAAG,GAAG,KAAK,MAAM;AAAA,EAChE;AACF;AAKO,SAAS,uBACd,SACwB;AACxB,QAAM,OAAO,QAAQ,sBAAsB;AAE3C,SAAO;AAAA,IACL,GAAG,KAAK;AAAA,IACR,GAAG,KAAK;AAAA,IACR,OAAO,KAAK;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,KAAK,KAAK;AAAA,IACV,OAAO,KAAK;AAAA,IACZ,QAAQ,KAAK;AAAA,IACb,MAAM,KAAK;AAAA,EACb;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,11 +10,17 @@
|
|
|
10
10
|
* properties for free:
|
|
11
11
|
*
|
|
12
12
|
* 1. `position: absolute` + page coordinates means the document's own
|
|
13
|
-
* scroll naturally translates the
|
|
14
|
-
* scroll frame, the browser composites
|
|
13
|
+
* scroll naturally translates the frames — zero JavaScript per
|
|
14
|
+
* scroll frame, the browser composites them with the underlying page
|
|
15
15
|
* content.
|
|
16
16
|
* 2. No bridge serialization: the only cost when selection commits is
|
|
17
|
-
* a handful of style writes on
|
|
17
|
+
* a handful of style writes on the frame nodes.
|
|
18
|
+
*
|
|
19
|
+
* A single click resolves to one frame; an area drag resolves to one
|
|
20
|
+
* frame per captured element, so the renderer keeps a pool of nodes
|
|
21
|
+
* under a shared container and reconciles it on each call (reusing
|
|
22
|
+
* existing nodes when the count is stable, which keeps the single-frame
|
|
23
|
+
* scroll-sync hot path a couple of style writes rather than a DOM churn).
|
|
18
24
|
*
|
|
19
25
|
* The canopy iframe loads a customer page and doesn't include lattice /
|
|
20
26
|
* tailwind, so styling is intentionally vanilla inline CSS rather than
|
|
@@ -29,11 +35,24 @@ type SelectionFramePageRect = {
|
|
|
29
35
|
width: number;
|
|
30
36
|
height: number;
|
|
31
37
|
};
|
|
38
|
+
type SelectionFrameSpec = {
|
|
39
|
+
pageRect: SelectionFramePageRect;
|
|
40
|
+
variant: SelectionFrameVariant;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Position selection frames at the given *page* coordinates, one node per
|
|
44
|
+
* spec. Page coords don't shift during scroll, so the caller is free to
|
|
45
|
+
* call this once at commit time and let the browser handle the rest of the
|
|
46
|
+
* scroll lifetime. Reconciles the node pool against `frames.length` so a
|
|
47
|
+
* repeated single-frame call (scroll sync) just repositions one node.
|
|
48
|
+
*
|
|
49
|
+
* @author Kevin O'Connell 2026-05-26
|
|
50
|
+
*/
|
|
51
|
+
export declare function showSelectionFrames({ frames, }: {
|
|
52
|
+
frames: SelectionFrameSpec[];
|
|
53
|
+
}): void;
|
|
32
54
|
/**
|
|
33
|
-
*
|
|
34
|
-
* coordinates. Page coords don't shift during scroll, so the caller is
|
|
35
|
-
* free to call this once at commit time and let the browser handle the
|
|
36
|
-
* rest of the scroll lifetime.
|
|
55
|
+
* Convenience wrapper for the single-frame (element click) case.
|
|
37
56
|
*
|
|
38
57
|
* @author Kevin O'Connell 2026-05-26
|
|
39
58
|
*/
|
|
@@ -1,74 +1,98 @@
|
|
|
1
1
|
const FUCHSIA_HEX = "#c026d3";
|
|
2
|
-
const
|
|
2
|
+
const FRAMES_CONTAINER_ID = "replo-select-mode-selection-frames";
|
|
3
3
|
function applyVariantStyle({
|
|
4
4
|
frame,
|
|
5
5
|
variant
|
|
6
6
|
}) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
frame.style.background = "rgba(192, 38, 211, 0.08)";
|
|
10
|
-
} else {
|
|
11
|
-
frame.style.border = `2px solid ${FUCHSIA_HEX}`;
|
|
12
|
-
frame.style.background = "transparent";
|
|
13
|
-
}
|
|
7
|
+
frame.style.border = `2px solid ${FUCHSIA_HEX}`;
|
|
8
|
+
frame.style.background = variant === "area" ? "rgba(192, 38, 211, 0.08)" : "transparent";
|
|
14
9
|
}
|
|
15
|
-
function
|
|
10
|
+
function getOrCreateContainer() {
|
|
16
11
|
if (typeof document === "undefined") {
|
|
17
12
|
return null;
|
|
18
13
|
}
|
|
19
|
-
const existing = document.getElementById(
|
|
14
|
+
const existing = document.getElementById(FRAMES_CONTAINER_ID);
|
|
20
15
|
if (existing instanceof HTMLDivElement) {
|
|
21
16
|
return existing;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
if (!document.body) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const container = document.createElement("div");
|
|
22
|
+
container.id = FRAMES_CONTAINER_ID;
|
|
23
|
+
container.setAttribute("aria-hidden", "true");
|
|
24
|
+
container.style.cssText = [
|
|
27
25
|
"position: absolute",
|
|
28
26
|
"top: 0",
|
|
29
27
|
"left: 0",
|
|
30
28
|
"width: 0",
|
|
31
29
|
"height: 0",
|
|
30
|
+
"margin: 0",
|
|
31
|
+
"padding: 0",
|
|
32
32
|
"pointer-events: none",
|
|
33
|
+
"z-index: 2147483646"
|
|
34
|
+
].join(";");
|
|
35
|
+
document.body.append(container);
|
|
36
|
+
return container;
|
|
37
|
+
}
|
|
38
|
+
function createFrameNode() {
|
|
39
|
+
const frame = document.createElement("div");
|
|
40
|
+
frame.setAttribute("aria-hidden", "true");
|
|
41
|
+
frame.style.cssText = [
|
|
42
|
+
"position: absolute",
|
|
43
|
+
"top: 0",
|
|
44
|
+
"left: 0",
|
|
33
45
|
"box-sizing: border-box",
|
|
34
46
|
"border-radius: 2px",
|
|
35
|
-
"
|
|
36
|
-
"display: none",
|
|
47
|
+
"pointer-events: none",
|
|
37
48
|
"margin: 0",
|
|
38
49
|
"padding: 0"
|
|
39
50
|
].join(";");
|
|
40
|
-
if (!document.body) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
document.body.append(frame);
|
|
44
51
|
return frame;
|
|
45
52
|
}
|
|
53
|
+
function showSelectionFrames({
|
|
54
|
+
frames
|
|
55
|
+
}) {
|
|
56
|
+
const container = getOrCreateContainer();
|
|
57
|
+
if (!container) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
while (container.childElementCount > frames.length) {
|
|
61
|
+
container.lastElementChild?.remove();
|
|
62
|
+
}
|
|
63
|
+
while (container.childElementCount < frames.length) {
|
|
64
|
+
container.append(createFrameNode());
|
|
65
|
+
}
|
|
66
|
+
frames.forEach((spec, index) => {
|
|
67
|
+
const frame = container.children[index];
|
|
68
|
+
if (!(frame instanceof HTMLDivElement)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
applyVariantStyle({ frame, variant: spec.variant });
|
|
72
|
+
frame.style.left = `${spec.pageRect.x}px`;
|
|
73
|
+
frame.style.top = `${spec.pageRect.y}px`;
|
|
74
|
+
frame.style.width = `${spec.pageRect.width}px`;
|
|
75
|
+
frame.style.height = `${spec.pageRect.height}px`;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
46
78
|
function showSelectionFrame({
|
|
47
79
|
pageRect,
|
|
48
80
|
variant
|
|
49
81
|
}) {
|
|
50
|
-
|
|
51
|
-
if (!frame) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
applyVariantStyle({ frame, variant });
|
|
55
|
-
frame.style.left = `${pageRect.x}px`;
|
|
56
|
-
frame.style.top = `${pageRect.y}px`;
|
|
57
|
-
frame.style.width = `${pageRect.width}px`;
|
|
58
|
-
frame.style.height = `${pageRect.height}px`;
|
|
59
|
-
frame.style.display = "block";
|
|
82
|
+
showSelectionFrames({ frames: [{ pageRect, variant }] });
|
|
60
83
|
}
|
|
61
84
|
function hideSelectionFrame() {
|
|
62
85
|
if (typeof document === "undefined") {
|
|
63
86
|
return;
|
|
64
87
|
}
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
|
|
88
|
+
const container = document.getElementById(FRAMES_CONTAINER_ID);
|
|
89
|
+
if (container instanceof HTMLDivElement) {
|
|
90
|
+
container.replaceChildren();
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
93
|
export {
|
|
71
94
|
hideSelectionFrame,
|
|
72
|
-
showSelectionFrame
|
|
95
|
+
showSelectionFrame,
|
|
96
|
+
showSelectionFrames
|
|
73
97
|
};
|
|
74
98
|
//# sourceMappingURL=selectionFrame.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/selectionFrame.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * In-iframe selection frame renderer.\n *\n * Lives in the canopy iframe (not in agent-ui) because the previous\n * parent-side overlay had to be re-anchored on every scroll frame via\n * postMessage hop -> Zustand update -> React reconciliation, which\n * shows up as visible lag when the user scrolls quickly.\n *\n * By rendering directly inside the canopy iframe's document we get two\n * properties for free:\n *\n * 1. `position: absolute` + page coordinates means the document's own\n * scroll naturally translates the
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * In-iframe selection frame renderer.\n *\n * Lives in the canopy iframe (not in agent-ui) because the previous\n * parent-side overlay had to be re-anchored on every scroll frame via\n * postMessage hop -> Zustand update -> React reconciliation, which\n * shows up as visible lag when the user scrolls quickly.\n *\n * By rendering directly inside the canopy iframe's document we get two\n * properties for free:\n *\n * 1. `position: absolute` + page coordinates means the document's own\n * scroll naturally translates the frames \u2014 zero JavaScript per\n * scroll frame, the browser composites them with the underlying page\n * content.\n * 2. No bridge serialization: the only cost when selection commits is\n * a handful of style writes on the frame nodes.\n *\n * A single click resolves to one frame; an area drag resolves to one\n * frame per captured element, so the renderer keeps a pool of nodes\n * under a shared container and reconciles it on each call (reusing\n * existing nodes when the count is stable, which keeps the single-frame\n * scroll-sync hot path a couple of style writes rather than a DOM churn).\n *\n * The canopy iframe loads a customer page and doesn't include lattice /\n * tailwind, so styling is intentionally vanilla inline CSS rather than\n * Tailwind classes.\n *\n * @author Kevin O'Connell 2026-05-26\n */\n\n// Matches `--color-fuchsia` (Tailwind v4 `fuchsia-600`) used by agent-ui\n// so the in-iframe frame is visually consistent with the rest of the\n// select-mode UI.\nconst FUCHSIA_HEX = \"#c026d3\";\n\nconst FRAMES_CONTAINER_ID = \"replo-select-mode-selection-frames\";\n\ntype SelectionFrameVariant = \"element\" | \"area\";\n\ntype SelectionFramePageRect = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\ntype SelectionFrameSpec = {\n pageRect: SelectionFramePageRect;\n variant: SelectionFrameVariant;\n};\n\nfunction applyVariantStyle({\n frame,\n variant,\n}: {\n frame: HTMLDivElement;\n variant: SelectionFrameVariant;\n}) {\n // Both variants use the same bright fuchsia border so a single click and\n // each member of an area selection read as equally \"selected\"; the area\n // members carry a faint fill so a cluster still reads as a group.\n frame.style.border = `2px solid ${FUCHSIA_HEX}`;\n frame.style.background =\n variant === \"area\" ? \"rgba(192, 38, 211, 0.08)\" : \"transparent\";\n}\n\nfunction getOrCreateContainer(): HTMLDivElement | null {\n if (typeof document === \"undefined\") {\n return null;\n }\n const existing = document.getElementById(FRAMES_CONTAINER_ID);\n if (existing instanceof HTMLDivElement) {\n return existing;\n }\n if (!document.body) {\n return null;\n }\n const container = document.createElement(\"div\");\n container.id = FRAMES_CONTAINER_ID;\n container.setAttribute(\"aria-hidden\", \"true\");\n container.style.cssText = [\n \"position: absolute\",\n \"top: 0\",\n \"left: 0\",\n \"width: 0\",\n \"height: 0\",\n \"margin: 0\",\n \"padding: 0\",\n \"pointer-events: none\",\n \"z-index: 2147483646\",\n ].join(\";\");\n document.body.append(container);\n return container;\n}\n\nfunction createFrameNode(): HTMLDivElement {\n const frame = document.createElement(\"div\");\n frame.setAttribute(\"aria-hidden\", \"true\");\n frame.style.cssText = [\n \"position: absolute\",\n \"top: 0\",\n \"left: 0\",\n \"box-sizing: border-box\",\n \"border-radius: 2px\",\n \"pointer-events: none\",\n \"margin: 0\",\n \"padding: 0\",\n ].join(\";\");\n return frame;\n}\n\n/**\n * Position selection frames at the given *page* coordinates, one node per\n * spec. Page coords don't shift during scroll, so the caller is free to\n * call this once at commit time and let the browser handle the rest of the\n * scroll lifetime. Reconciles the node pool against `frames.length` so a\n * repeated single-frame call (scroll sync) just repositions one node.\n *\n * @author Kevin O'Connell 2026-05-26\n */\nexport function showSelectionFrames({\n frames,\n}: {\n frames: SelectionFrameSpec[];\n}) {\n const container = getOrCreateContainer();\n if (!container) {\n return;\n }\n\n while (container.childElementCount > frames.length) {\n container.lastElementChild?.remove();\n }\n while (container.childElementCount < frames.length) {\n container.append(createFrameNode());\n }\n\n frames.forEach((spec, index) => {\n const frame = container.children[index];\n if (!(frame instanceof HTMLDivElement)) {\n return;\n }\n applyVariantStyle({ frame, variant: spec.variant });\n frame.style.left = `${spec.pageRect.x}px`;\n frame.style.top = `${spec.pageRect.y}px`;\n frame.style.width = `${spec.pageRect.width}px`;\n frame.style.height = `${spec.pageRect.height}px`;\n });\n}\n\n/**\n * Convenience wrapper for the single-frame (element click) case.\n *\n * @author Kevin O'Connell 2026-05-26\n */\nexport function showSelectionFrame({\n pageRect,\n variant,\n}: {\n pageRect: SelectionFramePageRect;\n variant: SelectionFrameVariant;\n}) {\n showSelectionFrames({ frames: [{ pageRect, variant }] });\n}\n\n/**\n * @author Kevin O'Connell 2026-05-26\n */\nexport function hideSelectionFrame() {\n if (typeof document === \"undefined\") {\n return;\n }\n const container = document.getElementById(FRAMES_CONTAINER_ID);\n if (container instanceof HTMLDivElement) {\n container.replaceChildren();\n }\n}\n"],
|
|
5
|
+
"mappings": "AAkCA,MAAM,cAAc;AAEpB,MAAM,sBAAsB;AAgB5B,SAAS,kBAAkB;AAAA,EACzB;AAAA,EACA;AACF,GAGG;AAID,QAAM,MAAM,SAAS,aAAa,WAAW;AAC7C,QAAM,MAAM,aACV,YAAY,SAAS,6BAA6B;AACtD;AAEA,SAAS,uBAA8C;AACrD,MAAI,OAAO,aAAa,aAAa;AACnC,WAAO;AAAA,EACT;AACA,QAAM,WAAW,SAAS,eAAe,mBAAmB;AAC5D,MAAI,oBAAoB,gBAAgB;AACtC,WAAO;AAAA,EACT;AACA,MAAI,CAAC,SAAS,MAAM;AAClB,WAAO;AAAA,EACT;AACA,QAAM,YAAY,SAAS,cAAc,KAAK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E,QAAQ,CAAC,EAAE,UAAU,QAAQ,CAAC,EAAE,CAAC;AACzD;AAKO,SAAS,qBAAqB;AACnC,MAAI,OAAO,aAAa,aAAa;AACnC;AAAA,EACF;AACA,QAAM,YAAY,SAAS,eAAe,mBAAmB;AAC7D,MAAI,qBAAqB,gBAAgB;AACvC,cAAU,gBAAgB;AAAA,EAC5B;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,12 +9,43 @@ function isLikelyCompiledLocation(location) {
|
|
|
9
9
|
function isServerChunk(filePath) {
|
|
10
10
|
return filePath.startsWith("about://React/Server") || filePath.includes("/server/chunks/") || filePath.includes(".next-dev/dev/server/") || filePath.includes(".next/server/");
|
|
11
11
|
}
|
|
12
|
+
const NEXT_STATIC_PATH_PATTERN = /\/_next(\/static\/.+)/;
|
|
13
|
+
function getNextDistDir() {
|
|
14
|
+
try {
|
|
15
|
+
const distDir = process.env.__NEXT_DIST_DIR;
|
|
16
|
+
return typeof distDir === "string" && distDir.length > 0 ? distDir : null;
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function rewriteBrowserChunkUrlToDistPath(filePath) {
|
|
22
|
+
if (!/^https?:\/\//.test(filePath)) {
|
|
23
|
+
return filePath;
|
|
24
|
+
}
|
|
25
|
+
const distDir = getNextDistDir();
|
|
26
|
+
if (!distDir) {
|
|
27
|
+
return filePath;
|
|
28
|
+
}
|
|
29
|
+
let url;
|
|
30
|
+
try {
|
|
31
|
+
url = new URL(filePath);
|
|
32
|
+
} catch {
|
|
33
|
+
return filePath;
|
|
34
|
+
}
|
|
35
|
+
const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);
|
|
36
|
+
if (!staticPathMatch?.[1]) {
|
|
37
|
+
return filePath;
|
|
38
|
+
}
|
|
39
|
+
const normalizedDistDir = distDir.replace(/\\/g, "/").replace(/\/$/, "");
|
|
40
|
+
return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;
|
|
41
|
+
}
|
|
12
42
|
function normalizeFilePathForSymbolicator(filePath) {
|
|
13
43
|
let normalized = filePath;
|
|
14
44
|
if (normalized.startsWith("about://React/Server/")) {
|
|
15
45
|
normalized = normalized.slice("about://React/Server/".length);
|
|
16
46
|
}
|
|
17
|
-
|
|
47
|
+
normalized = normalized.replace(/\?\d+$/, "");
|
|
48
|
+
return rewriteBrowserChunkUrlToDistPath(normalized);
|
|
18
49
|
}
|
|
19
50
|
function toNextStackFrame(location) {
|
|
20
51
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/symbolicate.ts"],
|
|
4
|
-
"sourcesContent": ["import type {\n SelectedElement,\n SelectModeSourceLocation,\n} from \"schemas/generated/selectMode\";\n\n/**\n * Runtime source-attribution for React 19 + Next.js Turbopack.\n *\n * React 19 removed `fiber._debugSource`; the only per-element source pointer\n * left is `fiber._debugStack`, whose `.stack` references compiled SSR/client\n * chunks. We POST those compiled frames to Next.js's dev-only\n * `/__nextjs_original-stack-frames` endpoint, which symbolicates them through\n * Turbopack's in-memory source maps \u2014 the same mechanism the Next error\n * overlay uses (see `next/dist/server/dev/middleware-turbopack.js`).\n */\n\ntype NextStackFrame = {\n file: string | null;\n methodName: string | null;\n arguments: string[];\n // Next.js's `/__nextjs_original-stack-frames` reads these as `line1`/`column1`\n // (1-based) in the request body \u2014 same field names it uses in the response.\n // Sending `lineNumber`/`column` is silently dropped on the server side.\n line1: number | null;\n column1: number | null;\n};\n\ntype ResolvedFrame = {\n file: string | null;\n line1?: number | null;\n column1?: number | null;\n methodName?: string | null;\n ignored?: boolean;\n arguments?: string[];\n};\n\ntype OriginalStackFrameResponse = {\n originalStackFrame: ResolvedFrame | null;\n originalCodeFrame: string | null;\n};\n\ntype SettledResponseEntry =\n | { status: \"fulfilled\"; value: OriginalStackFrameResponse }\n | { status: \"rejected\"; reason: string };\n\nconst SYMBOLICATE_ENDPOINT = \"/__nextjs_original-stack-frames\";\n\nfunction isLikelyCompiledLocation(\n location: SelectModeSourceLocation | undefined,\n): boolean {\n if (!location) {\n return false;\n }\n const filePath = location.filePath;\n return (\n filePath.includes(\".next\") ||\n filePath.includes(\"/chunks/\") ||\n filePath.includes(\"webpack-internal:\") ||\n filePath.includes(\"turbopack:\") ||\n filePath.endsWith(\".js\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// React 19 fibers for server-rendered (RSC) elements carry a `_debugStack`\n// whose top frame points at an SSR chunk. The endpoint resolves those\n// against the server bundler context; client chunks go through the client\n// bundler context. Mis-routing returns the compiled chunk unchanged.\nfunction isServerChunk(filePath: string): boolean {\n return (\n filePath.startsWith(\"about://React/Server\") ||\n filePath.includes(\"/server/chunks/\") ||\n filePath.includes(\".next-dev/dev/server/\") ||\n filePath.includes(\".next/server/\")\n );\n}\n\n// React 19's `_debugStack.stack` for RSC components wraps the SSR chunk URL\n// in an `about://React/Server/` prefix and appends a `?<digits>` cache-buster.\n// Turbopack's source-map lookup matches against the bare chunk URL; with\n// either decoration in place it returns the compiled chunk unchanged.\nfunction normalizeFilePathForSymbolicator(filePath: string): string {\n let normalized = filePath;\n if (normalized.startsWith(\"about://React/Server/\")) {\n normalized = normalized.slice(\"about://React/Server/\".length);\n }\n
|
|
5
|
-
"mappings": "AA6CA,MAAM,uBAAuB;AAE7B,SAAS,yBACP,UACS;AACT,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,WAAW,SAAS;AAC1B,SACE,SAAS,SAAS,OAAO,KACzB,SAAS,SAAS,UAAU,KAC5B,SAAS,SAAS,mBAAmB,KACrC,SAAS,SAAS,YAAY,KAC9B,SAAS,SAAS,KAAK,KACvB,SAAS,WAAW,QAAQ;AAEhC;AAMA,SAAS,cAAc,UAA2B;AAChD,SACE,SAAS,WAAW,sBAAsB,KAC1C,SAAS,SAAS,iBAAiB,KACnC,SAAS,SAAS,uBAAuB,KACzC,SAAS,SAAS,eAAe;AAErC;AAMA,SAAS,iCAAiC,UAA0B;AAClE,MAAI,aAAa;AACjB,MAAI,WAAW,WAAW,uBAAuB,GAAG;AAClD,iBAAa,WAAW,MAAM,wBAAwB,MAAM;AAAA,EAC9D;AACA,
|
|
4
|
+
"sourcesContent": ["import type {\n SelectedElement,\n SelectModeSourceLocation,\n} from \"schemas/generated/selectMode\";\n\n/**\n * Runtime source-attribution for React 19 + Next.js Turbopack.\n *\n * React 19 removed `fiber._debugSource`; the only per-element source pointer\n * left is `fiber._debugStack`, whose `.stack` references compiled SSR/client\n * chunks. We POST those compiled frames to Next.js's dev-only\n * `/__nextjs_original-stack-frames` endpoint, which symbolicates them through\n * Turbopack's in-memory source maps \u2014 the same mechanism the Next error\n * overlay uses (see `next/dist/server/dev/middleware-turbopack.js`).\n */\n\ntype NextStackFrame = {\n file: string | null;\n methodName: string | null;\n arguments: string[];\n // Next.js's `/__nextjs_original-stack-frames` reads these as `line1`/`column1`\n // (1-based) in the request body \u2014 same field names it uses in the response.\n // Sending `lineNumber`/`column` is silently dropped on the server side.\n line1: number | null;\n column1: number | null;\n};\n\ntype ResolvedFrame = {\n file: string | null;\n line1?: number | null;\n column1?: number | null;\n methodName?: string | null;\n ignored?: boolean;\n arguments?: string[];\n};\n\ntype OriginalStackFrameResponse = {\n originalStackFrame: ResolvedFrame | null;\n originalCodeFrame: string | null;\n};\n\ntype SettledResponseEntry =\n | { status: \"fulfilled\"; value: OriginalStackFrameResponse }\n | { status: \"rejected\"; reason: string };\n\nconst SYMBOLICATE_ENDPOINT = \"/__nextjs_original-stack-frames\";\n\nfunction isLikelyCompiledLocation(\n location: SelectModeSourceLocation | undefined,\n): boolean {\n if (!location) {\n return false;\n }\n const filePath = location.filePath;\n return (\n filePath.includes(\".next\") ||\n filePath.includes(\"/chunks/\") ||\n filePath.includes(\"webpack-internal:\") ||\n filePath.includes(\"turbopack:\") ||\n filePath.endsWith(\".js\") ||\n filePath.startsWith(\"about:\")\n );\n}\n\n// React 19 fibers for server-rendered (RSC) elements carry a `_debugStack`\n// whose top frame points at an SSR chunk. The endpoint resolves those\n// against the server bundler context; client chunks go through the client\n// bundler context. Mis-routing returns the compiled chunk unchanged.\nfunction isServerChunk(filePath: string): boolean {\n return (\n filePath.startsWith(\"about://React/Server\") ||\n filePath.includes(\"/server/chunks/\") ||\n filePath.includes(\".next-dev/dev/server/\") ||\n filePath.includes(\".next/server/\")\n );\n}\n\n// Matches the `/_next/static/...` tail of a browser chunk URL's pathname.\n// Capture group 1 is the `/static/...` segment that lives under the dist dir\n// on disk. Mirrors `regexNextStatic` in\n// `next/dist/server/lib/parse-stack.js`.\nconst NEXT_STATIC_PATH_PATTERN = /\\/_next(\\/static\\/.+)/;\n\n// Absolute path to the dev dist dir (e.g.\n// `/workspace/dev/website/.next-dev/dev`). Next.js define-injects this into\n// dev client bundles (see the `__NEXT_DIST_DIR` define in\n// `next/dist/build/define-env.ts`); because canopy-sdk is transpiled into the\n// host Next app, the replacement reaches this reference too. Outside a Next\n// dev client build the value is absent, so we bail and leave the URL as-is.\nfunction getNextDistDir(): string | null {\n try {\n const distDir = process.env.__NEXT_DIST_DIR;\n return typeof distDir === \"string\" && distDir.length > 0 ? distDir : null;\n } catch {\n return null;\n }\n}\n\n// Turbopack's `/__nextjs_original-stack-frames` backend only resolves source\n// maps for `file://` (or bare filesystem) paths \u2014 it rejects browser chunk\n// URLs (`https://host/_next/static/chunks/X.js`) with \"Unknown url scheme\",\n// which is why client-component frames never symbolicated in the sandbox\n// (everything is served over https) even though it worked for RSC frames that\n// already carry filesystem paths. Rewrite the URL to the on-disk dist path the\n// same way Next's own server-side stack parser does, so the endpoint can map\n// it back to the user's `.tsx`.\nfunction rewriteBrowserChunkUrlToDistPath(filePath: string): string {\n if (!/^https?:\\/\\//.test(filePath)) {\n return filePath;\n }\n const distDir = getNextDistDir();\n if (!distDir) {\n return filePath;\n }\n let url: URL;\n try {\n url = new URL(filePath);\n } catch {\n return filePath;\n }\n const staticPathMatch = NEXT_STATIC_PATH_PATTERN.exec(url.pathname);\n if (!staticPathMatch?.[1]) {\n return filePath;\n }\n const normalizedDistDir = distDir.replace(/\\\\/g, \"/\").replace(/\\/$/, \"\");\n return `file://${normalizedDistDir}${staticPathMatch[1]}${url.search}`;\n}\n\n// React 19's `_debugStack.stack` for RSC components wraps the SSR chunk URL\n// in an `about://React/Server/` prefix and appends a `?<digits>` cache-buster.\n// Turbopack's source-map lookup matches against the bare chunk URL; with\n// either decoration in place it returns the compiled chunk unchanged. Client\n// components instead carry a plain browser chunk URL, which Turbopack rejects\n// outright unless rewritten to its on-disk `file://` path.\nfunction normalizeFilePathForSymbolicator(filePath: string): string {\n let normalized = filePath;\n if (normalized.startsWith(\"about://React/Server/\")) {\n normalized = normalized.slice(\"about://React/Server/\".length);\n }\n normalized = normalized.replace(/\\?\\d+$/, \"\");\n return rewriteBrowserChunkUrlToDistPath(normalized);\n}\n\nfunction toNextStackFrame(location: SelectModeSourceLocation): NextStackFrame {\n return {\n file: normalizeFilePathForSymbolicator(location.filePath),\n methodName: location.componentName ?? null,\n arguments: [],\n line1: location.lineNumber,\n column1: location.columnNumber ?? null,\n };\n}\n\nfunction extractResolvedFrame(\n entry: SettledResponseEntry | null,\n): ResolvedFrame | null {\n if (!entry || entry.status !== \"fulfilled\") {\n return null;\n }\n return entry.value?.originalStackFrame ?? null;\n}\n\nasync function postFrames({\n frames,\n isServer,\n}: {\n frames: NextStackFrame[];\n isServer: boolean;\n}): Promise<(SettledResponseEntry | null)[]> {\n if (frames.length === 0) {\n return [];\n }\n try {\n const response = await fetch(SYMBOLICATE_ENDPOINT, {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n frames,\n isServer,\n isEdgeServer: false,\n isAppDirectory: true,\n }),\n });\n if (!response.ok) {\n console.log(\"[selectMode] symbolicate: endpoint returned non-OK status\", {\n status: response.status,\n isServer,\n });\n return frames.map(() => null);\n }\n const parsed: unknown = await response.json();\n if (Array.isArray(parsed)) {\n // Promise.allSettled-shaped entries; see\n // node_modules/next/dist/server/dev/middleware-turbopack.js.\n // Legacy cast - the runtime shape isn't exported as a type.\n // eslint-disable-next-line replo/no-as-cast\n return parsed as (SettledResponseEntry | null)[];\n }\n return frames.map(() => null);\n } catch (error) {\n console.log(\"[selectMode] symbolicate: fetch failed\", {\n isServer,\n error,\n });\n return frames.map(() => null);\n }\n}\n\nasync function symbolicateFrames(\n frames: NextStackFrame[],\n): Promise<(SettledResponseEntry | null)[]> {\n const serverIndices: number[] = [];\n const clientIndices: number[] = [];\n for (const [index, frame] of frames.entries()) {\n if (frame.file && isServerChunk(frame.file)) {\n serverIndices.push(index);\n } else {\n clientIndices.push(index);\n }\n }\n\n const [serverResults, clientResults] = await Promise.all([\n postFrames({\n frames: serverIndices.map((index) => frames[index]!),\n isServer: true,\n }),\n postFrames({\n frames: clientIndices.map((index) => frames[index]!),\n isServer: false,\n }),\n ]);\n\n const merged: (SettledResponseEntry | null)[] = frames.map(() => null);\n for (const [position, index] of serverIndices.entries()) {\n merged[index] = serverResults[position] ?? null;\n }\n for (const [position, index] of clientIndices.entries()) {\n merged[index] = clientResults[position] ?? null;\n }\n return merged;\n}\n\nfunction applyResolved({\n original,\n frame,\n}: {\n original: SelectModeSourceLocation;\n frame: ResolvedFrame | null;\n}): SelectModeSourceLocation {\n if (!frame || !frame.file || frame.line1 == null) {\n return original;\n }\n return {\n filePath: frame.file,\n lineNumber: frame.line1,\n columnNumber: frame.column1 ?? undefined,\n componentName: original.componentName,\n };\n}\n\nexport async function symbolicateSelectedElement(\n selectedElement: SelectedElement,\n): Promise<SelectedElement> {\n const sourceLocation = selectedElement.sourceLocation;\n if (!sourceLocation || !isLikelyCompiledLocation(sourceLocation)) {\n return selectedElement;\n }\n\n const resolved = await symbolicateFrames([toNextStackFrame(sourceLocation)]);\n const frame = extractResolvedFrame(resolved[0] ?? null);\n const nextLocation = applyResolved({ original: sourceLocation, frame });\n\n console.log(\"[selectMode] symbolicate: resolved\", {\n before: sourceLocation.filePath,\n after: nextLocation.filePath,\n });\n\n return {\n ...selectedElement,\n sourceLocation: nextLocation,\n };\n}\n\nexport async function symbolicateSelectedElements(\n elements: SelectedElement[],\n): Promise<SelectedElement[]> {\n return Promise.all(elements.map(symbolicateSelectedElement));\n}\n"],
|
|
5
|
+
"mappings": "AA6CA,MAAM,uBAAuB;AAE7B,SAAS,yBACP,UACS;AACT,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AACA,QAAM,WAAW,SAAS;AAC1B,SACE,SAAS,SAAS,OAAO,KACzB,SAAS,SAAS,UAAU,KAC5B,SAAS,SAAS,mBAAmB,KACrC,SAAS,SAAS,YAAY,KAC9B,SAAS,SAAS,KAAK,KACvB,SAAS,WAAW,QAAQ;AAEhC;AAMA,SAAS,cAAc,UAA2B;AAChD,SACE,SAAS,WAAW,sBAAsB,KAC1C,SAAS,SAAS,iBAAiB,KACnC,SAAS,SAAS,uBAAuB,KACzC,SAAS,SAAS,eAAe;AAErC;AAMA,MAAM,2BAA2B;AAQjC,SAAS,iBAAgC;AACvC,MAAI;AACF,UAAM,UAAU,QAAQ,IAAI;AAC5B,WAAO,OAAO,YAAY,YAAY,QAAQ,SAAS,IAAI,UAAU;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAUA,SAAS,iCAAiC,UAA0B;AAClE,MAAI,CAAC,eAAe,KAAK,QAAQ,GAAG;AAClC,WAAO;AAAA,EACT;AACA,QAAM,UAAU,eAAe;AAC/B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,MAAI;AACJ,MAAI;AACF,UAAM,IAAI,IAAI,QAAQ;AAAA,EACxB,QAAQ;AACN,WAAO;AAAA,EACT;AACA,QAAM,kBAAkB,yBAAyB,KAAK,IAAI,QAAQ;AAClE,MAAI,CAAC,kBAAkB,CAAC,GAAG;AACzB,WAAO;AAAA,EACT;AACA,QAAM,oBAAoB,QAAQ,QAAQ,OAA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AAM;AAAA,IAChB,YAAY,MAAM;AAAA,IAClB,cAAc,MAAM,WAAW;AAAA,IAC/B,eAAe,SAAS;AAAA,EAC1B;AACF;AAEA,eAAsB,2BACpB,iBAC0B;AAC1B,QAAM,iBAAiB,gBAAgB;AACvC,MAAI,CAAC,kBAAkB,CAAC,yBAAyB,cAAc,GAAG;AAChE,WAAO;AAAA,EACT;AAEA,QAAM,WAAW,MAAM,kBAAkB,CAAC,iBAAiB,cAAc,CAAC,CAAC;AAC3E,QAAM,QAAQ,qBAAqB,SAAS,CAAC,KAAK,IAAI;AACtD,QAAM,eAAe,cAAc,EAAE,UAAU,gBAAgB,MAAM,CAAC;AAEtE,UAAQ,IAAI,sCAAsC;AAAA,IAChD,QAAQ,eAAe;AAAA,IACvB,OAAO,aAAa;AAAA,EACtB,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,gBAAgB;AAAA,EAClB;AACF;AAEA,eAAsB,4BACpB,UAC4B;AAC5B,SAAO,QAAQ,IAAI,SAAS,IAAI,0BAA0B,CAAC;AAC7D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -5,19 +5,23 @@ import { CartLoader } from "../cart/cart-loader";
|
|
|
5
5
|
import { ClientErrorBoundary } from "../editor/ClientErrorBoundary";
|
|
6
6
|
import { DesignLibraryPreview } from "../editor/design-library-preview/DesignLibraryPreview";
|
|
7
7
|
import LinkInterceptor from "../editor/LinkInterceptor";
|
|
8
|
+
import { NextErrorReporter } from "../editor/NextErrorReporter";
|
|
8
9
|
import PostHogRelay from "../editor/posthog-relay";
|
|
9
10
|
import { EditorSelection } from "../editor/select-mode/EditorSelection";
|
|
10
11
|
import { QueryProvider } from "./query-provider";
|
|
11
12
|
function ReploProvider({ children }) {
|
|
12
13
|
return /* @__PURE__ */ jsx(QueryProvider, { children: /* @__PURE__ */ jsxs(AnalyticsProvider, { children: [
|
|
13
14
|
/* @__PURE__ */ jsx(ReploFirstPartyPixel, {}),
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */ jsx(
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
/* @__PURE__ */ jsxs(CartLoader, { children: [
|
|
16
|
+
/* @__PURE__ */ jsx(NextErrorReporter, {}),
|
|
17
|
+
/* @__PURE__ */ jsxs(ClientErrorBoundary, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(LinkInterceptor, {}),
|
|
19
|
+
/* @__PURE__ */ jsx(PostHogRelay, {}),
|
|
20
|
+
/* @__PURE__ */ jsx(EditorSelection, {}),
|
|
21
|
+
/* @__PURE__ */ jsx(DesignLibraryPreview, {}),
|
|
22
|
+
children
|
|
23
|
+
] })
|
|
24
|
+
] })
|
|
21
25
|
] }) });
|
|
22
26
|
}
|
|
23
27
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../providers/replo-provider.tsx"],
|
|
4
|
-
"sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { ReploFirstPartyPixel } from \"../analytics/replo-first-party-pixel\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"../editor/design-library-preview/DesignLibraryPreview\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <ReploFirstPartyPixel />\n <CartLoader>\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { AnalyticsProvider } from \"../analytics/analytics-provider\";\nimport { ReploFirstPartyPixel } from \"../analytics/replo-first-party-pixel\";\nimport { CartLoader } from \"../cart/cart-loader\";\nimport { ClientErrorBoundary } from \"../editor/ClientErrorBoundary\";\nimport { DesignLibraryPreview } from \"../editor/design-library-preview/DesignLibraryPreview\";\nimport LinkInterceptor from \"../editor/LinkInterceptor\";\nimport { NextErrorReporter } from \"../editor/NextErrorReporter\";\nimport PostHogRelay from \"../editor/posthog-relay\";\nimport { EditorSelection } from \"../editor/select-mode/EditorSelection\";\nimport { QueryProvider } from \"./query-provider\";\n\nexport function ReploProvider({ children }: React.PropsWithChildren) {\n return (\n <QueryProvider>\n <AnalyticsProvider>\n <ReploFirstPartyPixel />\n <CartLoader>\n {/* NOTE (Max, 2026-06-08): Outside ClientErrorBoundary on purpose \u2014 when\n the boundary catches a runtime error it swaps its children for a\n neutral cover, which would unmount the reporter and freeze it in the\n error state. It must stay mounted to observe Next's overlay across\n error <-> recover. */}\n <NextErrorReporter />\n <ClientErrorBoundary>\n <LinkInterceptor />\n <PostHogRelay />\n <EditorSelection />\n <DesignLibraryPreview />\n {children}\n </ClientErrorBoundary>\n </CartLoader>\n </AnalyticsProvider>\n </QueryProvider>\n );\n}\n"],
|
|
5
|
+
"mappings": "AAeQ,cAQE,YARF;AAfR,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,OAAO,qBAAqB;AAC5B,SAAS,yBAAyB;AAClC,OAAO,kBAAkB;AACzB,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAEvB,SAAS,cAAc,EAAE,SAAS,GAA4B;AACnE,SACE,oBAAC,iBACC,+BAAC,qBACC;AAAA,wBAAC,wBAAqB;AAAA,IACtB,qBAAC,cAMC;AAAA,0BAAC,qBAAkB;AAAA,MACnB,qBAAC,uBACC;AAAA,4BAAC,mBAAgB;AAAA,QACjB,oBAAC,gBAAa;AAAA,QACd,oBAAC,mBAAgB;AAAA,QACjB,oBAAC,wBAAqB;AAAA,QACrB;AAAA,SACH;AAAA,OACF;AAAA,KACF,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|