@supernovaio/prototyping-tooling
Advanced tools
| function o(n) { | ||
| if (n && typeof n == "object" && "source" in n) { | ||
| const e = n.source; | ||
| return typeof e == "string" && e.includes("react-devtools"); | ||
| } | ||
| return !1; | ||
| } | ||
| class E { | ||
| targetWindow; | ||
| targetOrigin; | ||
| constructor(e, s = "*") { | ||
| this.targetWindow = e, this.targetOrigin = s; | ||
| } | ||
| send(e, s) { | ||
| this.targetWindow.postMessage(e, s || this.targetOrigin || "*"); | ||
| } | ||
| onMessage(e) { | ||
| const s = (t) => { | ||
| e(t); | ||
| }; | ||
| return window.addEventListener("message", s), () => { | ||
| window.removeEventListener("message", s); | ||
| }; | ||
| } | ||
| } | ||
| class a { | ||
| send(e, s) { | ||
| window.parent && window.parent !== window && window.parent.postMessage(e, s || "*"); | ||
| } | ||
| onMessage(e) { | ||
| const s = (t) => { | ||
| e(t); | ||
| }; | ||
| return window.addEventListener("message", s), () => { | ||
| window.removeEventListener("message", s); | ||
| }; | ||
| } | ||
| } | ||
| const r = "host", O = "sandbox", T = { HOVER_OVERLAY: "9999", ANNOTATION_DOT: "10000", TOOLTIP: "10001" }, _ = { SELECT_OVERLAY_BORDER: "#1A58D0", SELECT_OVERLAY_BG: "#45ADFF17", DESIGN_SELECTION_OUTLINE: "#9333ea", ANNOTATION_SINGLE: "#1A58D0", ANNOTATION_MULTI: "#1A58D0", ANNOTATION_SINGLE_BG: "#45ADFF17", ANNOTATION_MULTI_BG: "#45ADFF17", DRAG_RECT_BG: "#45ADFF17" }, A = 20, N = 20, i = { CHILD_READY_DELAY: 1e3, CHILD_READY_RETRY_INTERVAL: 3e3, CONNECTION_TIMEOUT: 5e3 }, c = ["#root", "#app", "#__next", "[data-reactroot]"], I = 200, d = 30, D = 6; | ||
| export { | ||
| A as B, | ||
| _ as C, | ||
| O as M, | ||
| a as P, | ||
| c as R, | ||
| i as T, | ||
| E as W, | ||
| T as Z, | ||
| r as a, | ||
| D as b, | ||
| d as c, | ||
| I as d, | ||
| N as e, | ||
| o as i | ||
| }; |
+190
-158
@@ -1,4 +0,4 @@ | ||
| import { b as X, c as Y, R as U, d as B, Z as A, C as v, M as O, B as H, e as G, P as V, i as W, a as j, T as k } from "./constants-DqGvo09s.js"; | ||
| import { b as $, c as X, R as Y, d as U, Z as x, C as v, M as E, B as N, e as B, P as W, i as G, a as V, T as P } from "./constants-DHvpLY46.js"; | ||
| import { d as c } from "./debug-CLzmqn3R.js"; | ||
| class z { | ||
| class j { | ||
| registry = /* @__PURE__ */ new Map(); | ||
@@ -26,3 +26,3 @@ register(e, t) { | ||
| } | ||
| function M(r) { | ||
| function R(r) { | ||
| if (r.id) | ||
@@ -42,24 +42,24 @@ return [`*[@id="${r.id}"]`]; | ||
| } | ||
| function b(r) { | ||
| function I(r) { | ||
| return r.length === 1 && r[0].startsWith("*[@id=") ? `//${r[0]}` : "/" + r.join("/"); | ||
| } | ||
| const u = { FunctionComponent: 0, ClassComponent: 1, IndeterminateComponent: 2, HostRoot: 3, HostPortal: 4, HostComponent: 5, HostText: 6, Fragment: 7, Mode: 8, ContextConsumer: 9, ContextProvider: 10, ForwardRef: 11, Profiler: 12, SuspenseComponent: 13, MemoComponent: 14, SimpleMemoComponent: 15, LazyComponent: 16, IncompleteClassComponent: 17, DehydratedFragment: 18, SuspenseListComponent: 19, ScopeComponent: 21, OffscreenComponent: 22, LegacyHiddenComponent: 23, CacheComponent: 24, TracingMarkerComponent: 25, HostHoistable: 26, HostSingleton: 27, IncompleteFunctionComponent: 28, Throw: 29, ViewTransitionComponent: 30, ActivityComponent: 31 }, K = /* @__PURE__ */ new Set(["Component", "PureComponent", "Fragment", "Suspense", "Profiler", "StrictMode", "Routes", "Route", "Outlet", "Root", "ErrorBoundaryHandler", "HotReload", "Hot"]), J = [/Boundary$/, /BoundaryHandler$/, /Provider$/, /Consumer$/, /^(Inner|Outer)/, /Router$/, /^Client(Page|Segment|Root)/, /^Server(Root|Component|Render)/, /^RSC/, /Context$/, /^Hot(Reload)?$/, /^(Dev|React)(Overlay|Tools|Root)/, /Overlay$/, /Handler$/, /^With[A-Z]/, /Wrapper$/, /^Root$/]; | ||
| let T = null; | ||
| function x(r) { | ||
| const u = { FunctionComponent: 0, ClassComponent: 1, IndeterminateComponent: 2, HostRoot: 3, HostPortal: 4, HostComponent: 5, HostText: 6, Fragment: 7, Mode: 8, ContextConsumer: 9, ContextProvider: 10, ForwardRef: 11, Profiler: 12, SuspenseComponent: 13, MemoComponent: 14, SimpleMemoComponent: 15, LazyComponent: 16, IncompleteClassComponent: 17, DehydratedFragment: 18, SuspenseListComponent: 19, ScopeComponent: 21, OffscreenComponent: 22, LegacyHiddenComponent: 23, CacheComponent: 24, TracingMarkerComponent: 25, HostHoistable: 26, HostSingleton: 27, IncompleteFunctionComponent: 28, Throw: 29, ViewTransitionComponent: 30, ActivityComponent: 31 }, z = /* @__PURE__ */ new Set(["Component", "PureComponent", "Fragment", "Suspense", "Profiler", "StrictMode", "Routes", "Route", "Outlet", "Root", "ErrorBoundaryHandler", "HotReload", "Hot"]), K = [/Boundary$/, /BoundaryHandler$/, /Provider$/, /Consumer$/, /^(Inner|Outer)/, /Router$/, /^Client(Page|Segment|Root)/, /^Server(Root|Component|Render)/, /^RSC/, /Context$/, /^Hot(Reload)?$/, /^(Dev|React)(Overlay|Tools|Root)/, /Overlay$/, /Handler$/, /^With[A-Z]/, /Wrapper$/, /^Root$/]; | ||
| let b = null; | ||
| function O(r) { | ||
| const e = (t) => t.some((n) => n.startsWith("__reactFiber$") || n.startsWith("__reactInternalInstance$") || n.startsWith("__reactProps$")); | ||
| return e(Object.keys(r)) || e(Object.getOwnPropertyNames(r)); | ||
| } | ||
| function q() { | ||
| if (T !== null) return T; | ||
| function J() { | ||
| if (b !== null) return b; | ||
| if (typeof document > "u") return !1; | ||
| if (document.body && x(document.body)) | ||
| return c("client", "Detected React on document.body"), T = !0, !0; | ||
| for (const e of U) { | ||
| if (document.body && O(document.body)) | ||
| return c("client", "Detected React on document.body"), b = !0, !0; | ||
| for (const e of Y) { | ||
| const t = document.querySelector(e); | ||
| if (t) { | ||
| if (x(t)) | ||
| return c("client", "Detected React on", e), T = !0, !0; | ||
| if (O(t)) | ||
| return c("client", "Detected React on", e), b = !0, !0; | ||
| for (const n of t.children) | ||
| if (x(n)) | ||
| return c("client", "Detected React on child of", e), T = !0, !0; | ||
| if (O(n)) | ||
| return c("client", "Detected React on child of", e), b = !0, !0; | ||
| } | ||
@@ -69,14 +69,14 @@ } | ||
| for (const e of document.body.children) | ||
| if (x(e)) | ||
| return c("client", "Detected React on body child:", e.tagName), T = !0, !0; | ||
| if (O(e)) | ||
| return c("client", "Detected React on body child:", e.tagName), b = !0, !0; | ||
| } | ||
| const r = document.querySelectorAll("*"); | ||
| for (const e of r) { | ||
| if (x(e)) | ||
| return c("client", "Detected React on deep scan:", e.tagName), T = !0, !0; | ||
| if (r.length > B) break; | ||
| if (O(e)) | ||
| return c("client", "Detected React on deep scan:", e.tagName), b = !0, !0; | ||
| if (r.length > U) break; | ||
| } | ||
| return c("client", "React NOT detected on page"), T = !1, !1; | ||
| return c("client", "React NOT detected on page"), b = !1, !1; | ||
| } | ||
| function Z(r) { | ||
| function q(r) { | ||
| const e = Object.keys(r); | ||
@@ -97,6 +97,6 @@ let t = e.find((s) => s.startsWith("__reactFiber$")); | ||
| } | ||
| function I(r) { | ||
| function S(r) { | ||
| return r ? r.displayName ? r.displayName : r.name ? r.name : null : null; | ||
| } | ||
| function Q(r) { | ||
| function Z(r) { | ||
| const { tag: e, type: t, elementType: n } = r; | ||
@@ -107,6 +107,6 @@ if ((/* @__PURE__ */ new Set([u.HostComponent, u.HostText, u.HostHoistable, u.HostSingleton, u.Fragment, u.Mode, u.Profiler, u.DehydratedFragment, u.HostRoot, u.HostPortal, u.ScopeComponent, u.OffscreenComponent, u.LegacyHiddenComponent, u.CacheComponent, u.TracingMarkerComponent, u.Throw, u.ViewTransitionComponent, u.ActivityComponent, u.SuspenseComponent, u.SuspenseListComponent])).has(e)) return null; | ||
| if (i?.render) { | ||
| const s = I(i.render); | ||
| const s = S(i.render); | ||
| if (s) return s; | ||
| } | ||
| return i?.displayName ? i.displayName : I(t); | ||
| return i?.displayName ? i.displayName : S(t); | ||
| } | ||
@@ -116,6 +116,6 @@ if (e === u.MemoComponent || e === u.SimpleMemoComponent) { | ||
| if (i?.type) { | ||
| const s = I(i.type); | ||
| const s = S(i.type); | ||
| if (s) return s; | ||
| } | ||
| return i?.displayName ? i.displayName : I(t); | ||
| return i?.displayName ? i.displayName : S(t); | ||
| } | ||
@@ -132,21 +132,21 @@ if (e === u.ContextProvider) { | ||
| const i = n; | ||
| return i?._status === 1 && i._result ? I(i._result) : null; | ||
| return i?._status === 1 && i._result ? S(i._result) : null; | ||
| } | ||
| return e === u.IncompleteClassComponent || e === u.IncompleteFunctionComponent || e === u.FunctionComponent || e === u.ClassComponent || e === u.IndeterminateComponent ? I(t) : null; | ||
| return e === u.IncompleteClassComponent || e === u.IncompleteFunctionComponent || e === u.FunctionComponent || e === u.ClassComponent || e === u.IndeterminateComponent ? S(t) : null; | ||
| } | ||
| function ee(r) { | ||
| function Q(r) { | ||
| return r.length <= 2 || r.length <= 3 && r === r.toLowerCase(); | ||
| } | ||
| function te(r) { | ||
| return !(K.has(r) || J.some((e) => e.test(r))); | ||
| function ee(r) { | ||
| return !(z.has(r) || K.some((e) => e.test(r))); | ||
| } | ||
| function ne(r, e = X, t = Y) { | ||
| if (!q()) | ||
| function te(r, e = $, t = X) { | ||
| if (!J()) | ||
| return c("client", "isReactPage() = false"), { path: null, components: [] }; | ||
| const n = []; | ||
| try { | ||
| let i = Z(r), s = 0; | ||
| let i = q(r), s = 0; | ||
| for (; i && s < t && n.length < e; ) { | ||
| const a = Q(i); | ||
| a && !ee(a) && te(a) && n.push(a), i = i.return, s++; | ||
| const a = Z(i); | ||
| a && !Q(a) && ee(a) && n.push(a), i = i.return, s++; | ||
| } | ||
@@ -158,26 +158,20 @@ } catch (i) { | ||
| } | ||
| let S = null, E = null; | ||
| function N(r, e, t, n = "solid") { | ||
| let C = null; | ||
| function D(r, e, t, n = "solid") { | ||
| const o = document.createElement("div"); | ||
| return Object.assign(o.style, { position: "fixed", left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px`, border: `1px ${n} ${e}`, backgroundColor: t, pointerEvents: "none", zIndex: A.HOVER_OVERLAY, borderRadius: "2px" }), o; | ||
| return Object.assign(o.style, { position: "fixed", left: `${r.left}px`, top: `${r.top}px`, width: `${r.width}px`, height: `${r.height}px`, border: `1px ${n} ${e}`, backgroundColor: t, pointerEvents: "none", zIndex: x.HOVER_OVERLAY, borderRadius: "2px" }), o; | ||
| } | ||
| function oe(r) { | ||
| R(); | ||
| function ne(r) { | ||
| M(); | ||
| const e = r.getBoundingClientRect(); | ||
| S = N(e, v.SELECT_OVERLAY_BORDER, v.SELECT_OVERLAY_BG), S.className = "forge-overlay", document.body.appendChild(S); | ||
| C = D(e, v.SELECT_OVERLAY_BORDER, v.SELECT_OVERLAY_BG), C.className = "forge-overlay", document.body.appendChild(C); | ||
| } | ||
| function R() { | ||
| S && (S.remove(), S = null); | ||
| function M() { | ||
| C && (C.remove(), C = null); | ||
| } | ||
| let oe = 0; | ||
| function ie() { | ||
| return E || (E = document.createElement("div"), Object.assign(E.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex: A.HIT_TEST_OVERLAY, cursor: "crosshair" }), E.className = "forge-hit-test-overlay", document.body.appendChild(E), E); | ||
| return `ann-${Date.now()}-${++oe}`; | ||
| } | ||
| function se() { | ||
| E && (E.remove(), E = null); | ||
| } | ||
| let re = 0; | ||
| function ae() { | ||
| return `ann-${Date.now()}-${++re}`; | ||
| } | ||
| class D { | ||
| class T { | ||
| active = !1; | ||
@@ -187,3 +181,2 @@ messenger; | ||
| componentTooltip = null; | ||
| hitTestOverlay = null; | ||
| dragRect = null; | ||
@@ -207,6 +200,6 @@ dragHighlights = []; | ||
| activate() { | ||
| this.active || (this.active = !0, c("annotation", "Annotation mode activated"), this.createHitTestOverlay(), this.addListeners(), this.setMarkersVisible(!0), document.body.style.cursor = "crosshair"); | ||
| this.active || (this.active = !0, c("annotation", "Annotation mode activated"), this.addListeners(), this.setMarkersVisible(!0), document.body.style.cursor = "crosshair"); | ||
| } | ||
| deactivate() { | ||
| this.active && (this.active = !1, c("annotation", "Annotation mode deactivated"), this.removeHoverOverlay(), this.clearAnnotationHighlights(), this.removeHitTestOverlay(), this.removeDragRect(), this.removeListeners(), this.setMarkersVisible(!1), document.body.style.cursor = ""); | ||
| this.active && (this.active = !1, c("annotation", "Annotation mode deactivated"), this.removeHoverOverlay(), this.clearAnnotationHighlights(), this.removeDragRect(), this.removeListeners(), this.setMarkersVisible(!1), document.body.style.cursor = ""); | ||
| } | ||
@@ -228,3 +221,3 @@ selectDot(e) { | ||
| for (const n of t) { | ||
| const o = { xpath: b(n.xpath), forgeId: n.forgeId, forgeIdIndex: n.forgeIdIndex }, i = this.resolveLocator(o); | ||
| const o = { xpath: I(n.xpath), forgeId: n.forgeId, forgeIdIndex: n.forgeIdIndex }, i = this.resolveLocator(o); | ||
| i && this.accumulationElements.push(i); | ||
@@ -257,6 +250,6 @@ } | ||
| } | ||
| return { xpath: b(M(e)), forgeId: t, forgeIdIndex: n }; | ||
| return { xpath: I(R(e)), forgeId: t, forgeIdIndex: n }; | ||
| } | ||
| elementToInfo(e) { | ||
| return { elementTag: e.tagName.toLowerCase(), xpath: M(e), componentName: e.getAttribute("data-component") || void 0, componentPath: this.getComponentPath(e) || void 0, forgeId: e.getAttribute("data-forge-id") || void 0, forgeIdIndex: this.resolveForgeIdIndex(e), sourcePos: e.getAttribute("data-source-pos") || void 0 }; | ||
| return { elementTag: e.tagName.toLowerCase(), xpath: R(e), componentName: e.getAttribute("data-component") || void 0, componentPath: this.getComponentPath(e) || void 0, forgeId: e.getAttribute("data-forge-id") || void 0, forgeIdIndex: this.resolveForgeIdIndex(e), sourcePos: e.getAttribute("data-source-pos") || void 0 }; | ||
| } | ||
@@ -273,7 +266,7 @@ resolveForgeIdIndex(e) { | ||
| if (e.length === 0) { | ||
| this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: 0, dotY: 0, mode: "single", elements: [], xpaths: [], elementTag: "" }, origin: O }); | ||
| this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: 0, dotY: 0, mode: "single", elements: [], xpaths: [], elementTag: "" }, origin: E }); | ||
| return; | ||
| } | ||
| const n = e[e.length - 1].getBoundingClientRect(), o = n.left + n.width / 2, i = n.bottom, s = e.map((g) => this.elementToInfo(g)), a = e.map((g) => this.elementToLocator(g)), l = this.getAnchorRect(a), h = o - 2, d = i - H - 2, m = l && l.width > 0 && l.height > 0 ? { x: (h - l.left) / l.width, y: (d - l.top) / l.height } : { x: 0, y: 0 }, p = s[0]; | ||
| this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: o, dotY: i, anchorOffset: m, mode: e.length > 1 ? "multi" : "single", elements: s, xpaths: s.map((g) => b(g.xpath)), elementTag: p.elementTag, componentName: p.componentName, componentPath: p.componentPath, forgeId: p.forgeId, sourcePos: p.sourcePos }, origin: O }); | ||
| const n = e[e.length - 1].getBoundingClientRect(), o = n.left + n.width / 2, i = n.bottom, s = e.map((g) => this.elementToInfo(g)), a = e.map((g) => this.elementToLocator(g)), l = this.getAnchorRect(a), h = o - 2, d = i - N - 2, m = l && l.width > 0 && l.height > 0 ? { x: (h - l.left) / l.width, y: (d - l.top) / l.height } : { x: 0, y: 0 }, f = s[0]; | ||
| this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: o, dotY: i, anchorOffset: m, mode: e.length > 1 ? "multi" : "single", elements: s, xpaths: s.map((g) => I(g.xpath)), elementTag: f.elementTag, componentName: f.componentName, componentPath: f.componentPath, forgeId: f.forgeId, sourcePos: f.sourcePos }, origin: E }); | ||
| } | ||
@@ -290,3 +283,3 @@ removeDot(e) { | ||
| for (const t of e) { | ||
| const n = t.elements.map((i) => ({ xpath: b(i.xpath), forgeId: i.forgeId, forgeIdIndex: i.forgeIdIndex })), o = this.getAnchorRect(n); | ||
| const n = t.elements.map((i) => ({ xpath: I(i.xpath), forgeId: i.forgeId, forgeIdIndex: i.forgeIdIndex })), o = this.getAnchorRect(n); | ||
| if (o && t.anchorOffset && o.width > 0 && o.height > 0) { | ||
@@ -324,12 +317,6 @@ const i = { rx: t.anchorOffset.x, ry: t.anchorOffset.y }, s = o.left + i.rx * o.width, a = o.top + i.ry * o.height; | ||
| }; | ||
| createHitTestOverlay() { | ||
| this.hitTestOverlay || (this.hitTestOverlay = document.createElement("div"), Object.assign(this.hitTestOverlay.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex: A.HIT_TEST_OVERLAY, cursor: "crosshair" }), this.hitTestOverlay.className = "forge-annotation-hit-test", document.body.appendChild(this.hitTestOverlay)); | ||
| } | ||
| removeHitTestOverlay() { | ||
| this.hitTestOverlay && (this.hitTestOverlay.remove(), this.hitTestOverlay = null); | ||
| } | ||
| showHoverOverlay(e, t, n) { | ||
| this.hoverOverlay && (this.hoverOverlay.remove(), this.hoverOverlay = null), this.lastHoveredElement = e; | ||
| const o = e.getBoundingClientRect(), i = t === v.ANNOTATION_MULTI ? v.ANNOTATION_MULTI_BG : v.ANNOTATION_SINGLE_BG; | ||
| this.hoverOverlay = N(o, t, i, "solid"), this.hoverOverlay.style.transition = "all 0.05s ease", this.hoverOverlay.className = "forge-annotation-hover", document.body.appendChild(this.hoverOverlay), this.showComponentTooltip(n || e, o); | ||
| this.hoverOverlay = D(o, t, i, "solid"), this.hoverOverlay.style.transition = "all 0.05s ease", this.hoverOverlay.className = "forge-annotation-hover", document.body.appendChild(this.hoverOverlay), this.showComponentTooltip(n || e, o); | ||
| } | ||
@@ -379,3 +366,3 @@ removeHoverOverlay() { | ||
| n.push(s); | ||
| const a = N(s, v.ANNOTATION_SINGLE, v.ANNOTATION_SINGLE_BG, "solid"); | ||
| const a = D(s, v.ANNOTATION_SINGLE, v.ANNOTATION_SINGLE_BG, "solid"); | ||
| a.className = "forge-annotation-highlight", document.body.appendChild(a), this.annotationHighlights.push(a); | ||
@@ -385,3 +372,3 @@ } | ||
| if (t && n.length > 1) { | ||
| const o = Math.min(...n.map((d) => d.left)), i = Math.min(...n.map((d) => d.top)), s = Math.max(...n.map((d) => d.right)), a = Math.max(...n.map((d) => d.bottom)), l = new DOMRect(o, i, s - o, a - i), h = N(l, v.ANNOTATION_SINGLE, "transparent", "dashed"); | ||
| const o = Math.min(...n.map((d) => d.left)), i = Math.min(...n.map((d) => d.top)), s = Math.max(...n.map((d) => d.right)), a = Math.max(...n.map((d) => d.bottom)), l = new DOMRect(o, i, s - o, a - i), h = D(l, v.ANNOTATION_SINGLE, "transparent", "dashed"); | ||
| h.className = "forge-annotation-bounding-rect", document.body.appendChild(h), this.annotationHighlights.push(h); | ||
@@ -419,3 +406,3 @@ } | ||
| } | ||
| const i = ne(e), s = [...t]; | ||
| const i = te(e), s = [...t]; | ||
| if (i.components.length > 0) | ||
@@ -432,3 +419,3 @@ for (const a of i.components) | ||
| const o = document.createElement("div"); | ||
| Object.assign(o.style, { position: "fixed", zIndex: A.TOOLTIP, backgroundColor: "rgb(238, 248, 255)", color: "rgba(26, 88, 208, 1)", border: "1px solid rgba(86, 153, 255, 0.3)", padding: "4px", borderRadius: "5px", fontSize: "12px", fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", whiteSpace: "nowrap", pointerEvents: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.3)", transition: "opacity 0.1s ease" }), o.textContent = n.map((l) => `<${l}>`).join(" "), o.className = "forge-annotation-component-tooltip", document.body.appendChild(o); | ||
| Object.assign(o.style, { position: "fixed", zIndex: x.TOOLTIP, backgroundColor: "rgb(238, 248, 255)", color: "rgba(26, 88, 208, 1)", border: "1px solid rgba(86, 153, 255, 0.3)", padding: "4px", borderRadius: "5px", fontSize: "12px", fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", whiteSpace: "nowrap", pointerEvents: "none", boxShadow: "0 2px 8px rgba(0,0,0,0.3)", transition: "opacity 0.1s ease" }), o.textContent = n.map((l) => `<${l}>`).join(" "), o.className = "forge-annotation-component-tooltip", document.body.appendChild(o); | ||
| const i = o.getBoundingClientRect(); | ||
@@ -442,3 +429,3 @@ let s = t.left + t.width / 2 - i.width / 2, a = t.top - i.height - 6; | ||
| showDragRect(e, t, n, o) { | ||
| this.dragRect || (this.dragRect = document.createElement("div"), Object.assign(this.dragRect.style, { position: "fixed", border: `1px dashed ${v.ANNOTATION_MULTI}`, backgroundColor: v.DRAG_RECT_BG, pointerEvents: "none", zIndex: A.HOVER_OVERLAY, borderRadius: "4px" }), this.dragRect.className = "forge-annotation-drag-rect", document.body.appendChild(this.dragRect)), Object.assign(this.dragRect.style, { left: `${Math.min(e, n)}px`, top: `${Math.min(t, o)}px`, width: `${Math.abs(n - e)}px`, height: `${Math.abs(o - t)}px` }); | ||
| this.dragRect || (this.dragRect = document.createElement("div"), Object.assign(this.dragRect.style, { position: "fixed", border: `1px dashed ${v.ANNOTATION_MULTI}`, backgroundColor: v.DRAG_RECT_BG, pointerEvents: "none", zIndex: x.HOVER_OVERLAY, borderRadius: "4px" }), this.dragRect.className = "forge-annotation-drag-rect", document.body.appendChild(this.dragRect)), Object.assign(this.dragRect.style, { left: `${Math.min(e, n)}px`, top: `${Math.min(t, o)}px`, width: `${Math.abs(n - e)}px`, height: `${Math.abs(o - t)}px` }); | ||
| } | ||
@@ -451,3 +438,3 @@ removeDragRect() { | ||
| for (const t of e) { | ||
| const n = t.getBoundingClientRect(), o = N(n, v.ANNOTATION_MULTI, v.ANNOTATION_MULTI_BG, "solid"); | ||
| const n = t.getBoundingClientRect(), o = D(n, v.ANNOTATION_MULTI, v.ANNOTATION_MULTI_BG, "solid"); | ||
| o.className = "forge-annotation-drag-highlight", document.body.appendChild(o), this.dragHighlights.push(o); | ||
@@ -461,3 +448,3 @@ } | ||
| createDot(e, t, n, o, i, s = []) { | ||
| const a = this.getAnchorRect(s), l = e - 2, h = t - H - 2, d = a && a.width > 0 && a.height > 0 ? { rx: (l - a.left) / a.width, ry: (h - a.top) / a.height } : { rx: 0, ry: 0 }; | ||
| const a = this.getAnchorRect(s), l = e - 2, h = t - N - 2, d = a && a.width > 0 && a.height > 0 ? { rx: (l - a.left) / a.width, ry: (h - a.top) / a.height } : { rx: 0, ry: 0 }; | ||
| this.createDotAtPosition(l, h, n, o, i, s, d); | ||
@@ -467,3 +454,3 @@ } | ||
| const l = document.createElement("div"); | ||
| Object.assign(l.style, { position: "fixed", left: `${e}px`, top: `${t}px`, minWidth: `${G}px`, height: `${H}px`, borderRadius: "50% 50% 50% 0", backgroundColor: "#FFFFFF", border: "1px solid #1A58D0", cursor: "pointer", zIndex: A.ANNOTATION_DOT, transition: "transform 0.15s ease", display: this.markersVisible ? "flex" : "none", alignItems: "center", justifyContent: "center", padding: "0 4px", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", fontSize: "11px", fontWeight: "700", color: "#1A58D0", lineHeight: "1", userSelect: "none", boxShadow: "0px 1px 3px -1px rgba(9, 18, 42, 0.06), 0px 1px 3px -3px rgba(9, 18, 42, 0.1)" }), l.textContent = String(i), l.className = "forge-annotation-dot", l.dataset.annotationId = o, l.addEventListener("mouseenter", () => { | ||
| Object.assign(l.style, { position: "fixed", left: `${e}px`, top: `${t}px`, minWidth: `${B}px`, height: `${N}px`, borderRadius: "50% 50% 50% 0", backgroundColor: "#FFFFFF", border: "1px solid #1A58D0", cursor: "pointer", zIndex: x.ANNOTATION_DOT, transition: "transform 0.15s ease", display: this.markersVisible ? "flex" : "none", alignItems: "center", justifyContent: "center", padding: "0 4px", fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif", fontSize: "11px", fontWeight: "700", color: "#1A58D0", lineHeight: "1", userSelect: "none", boxShadow: "0px 1px 3px -1px rgba(9, 18, 42, 0.06), 0px 1px 3px -3px rgba(9, 18, 42, 0.1)" }), l.textContent = String(i), l.className = "forge-annotation-dot", l.dataset.annotationId = o, l.addEventListener("mouseenter", () => { | ||
| l.style.transform = "scale(1.05)", this.removeHoverOverlay(); | ||
@@ -477,3 +464,3 @@ }), l.addEventListener("mouseleave", () => { | ||
| const m = l.getBoundingClientRect(); | ||
| this.messenger.send({ type: "ANNOTATION_DOT_CLICKED", annotationId: o, dotX: m.left, dotY: m.bottom, origin: O }); | ||
| this.messenger.send({ type: "ANNOTATION_DOT_CLICKED", annotationId: o, dotX: m.left, dotY: m.bottom, origin: E }); | ||
| }), document.body.appendChild(l), this.dots.set(o, { id: o, element: l, mode: n, order: i, locators: s, anchorRatio: a }); | ||
@@ -488,5 +475,5 @@ } | ||
| elementAtPoint(e, t) { | ||
| this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none"), this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "none"); | ||
| this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "none"); | ||
| const n = document.elementFromPoint(e, t); | ||
| return this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "auto"), this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "auto"), !n || n === document.body || n === document.documentElement ? null : this.escapeToSvgRoot(n); | ||
| return this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "auto"), !n || n === document.body || n === document.documentElement ? null : this.escapeToSvgRoot(n); | ||
| } | ||
@@ -524,15 +511,15 @@ escapeToSvgRoot(e) { | ||
| const i = Math.min(e, n), s = Math.min(t, o), a = Math.max(e, n), l = Math.max(t, o), h = document.querySelectorAll("[data-forge-id]"), d = [], m = /* @__PURE__ */ new Set(); | ||
| if (h.forEach((p) => { | ||
| const g = p, y = g.getAttribute("data-forge-id"); | ||
| if (h.forEach((f) => { | ||
| const g = f, y = g.getAttribute("data-forge-id"); | ||
| if (!y || m.has(y) || g instanceof SVGElement && g.tagName.toLowerCase() !== "svg" || g.closest?.("svg") && g.tagName.toLowerCase() !== "svg") return; | ||
| const f = this.findTopmostWithSameForgeId(g); | ||
| if (m.has(f.getAttribute("data-forge-id") || "")) return; | ||
| const L = f.getBoundingClientRect(); | ||
| L.right >= i && L.left <= a && L.bottom >= s && L.top <= l && (m.add(y), d.push(f)); | ||
| const p = this.findTopmostWithSameForgeId(g); | ||
| if (m.has(p.getAttribute("data-forge-id") || "")) return; | ||
| const L = p.getBoundingClientRect(); | ||
| L.right >= i && L.left <= a && L.bottom >= s && L.top <= l && (m.add(y), d.push(p)); | ||
| }), this.dragScopeParent) { | ||
| const p = this.findForgeIdParent(this.dragScopeParent); | ||
| if (p) | ||
| const f = this.findForgeIdParent(this.dragScopeParent); | ||
| if (f) | ||
| return d.filter((y) => { | ||
| const f = this.findForgeIdParent(y); | ||
| return f ? this.findForgeIdParent(f) === p : !1; | ||
| const p = this.findForgeIdParent(y); | ||
| return p ? this.findForgeIdParent(p) === f : !1; | ||
| }); | ||
@@ -545,2 +532,3 @@ const g = this.dragScopeParent; | ||
| handleMouseMove = (e) => { | ||
| if (this.isAnnotationDotEventTarget(e)) return; | ||
| if (this.hoverSuppressed) { | ||
@@ -558,3 +546,3 @@ this.removeHoverOverlay(); | ||
| const n = e.clientX - this.dragStartX, o = e.clientY - this.dragStartY; | ||
| if (Math.abs(n) > D.DRAG_THRESHOLD || Math.abs(o) > D.DRAG_THRESHOLD) { | ||
| if (Math.abs(n) > T.DRAG_THRESHOLD || Math.abs(o) > T.DRAG_THRESHOLD) { | ||
| this.isDragging = !0; | ||
@@ -573,2 +561,3 @@ return; | ||
| handleMouseDown = (e) => { | ||
| if (this.isAnnotationDotEventTarget(e)) return; | ||
| this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.isDragging = !1; | ||
@@ -584,2 +573,3 @@ const t = this.elementAtPoint(e.clientX, e.clientY); | ||
| handleMouseUp = (e) => { | ||
| if (this.isAnnotationDotEventTarget(e)) return; | ||
| if (this.isDragging) { | ||
@@ -608,4 +598,8 @@ this.isDragging = !1; | ||
| handleClick = (e) => { | ||
| e.preventDefault(), e.stopPropagation(); | ||
| this.isAnnotationDotEventTarget(e) || (e.preventDefault(), e.stopPropagation()); | ||
| }; | ||
| isAnnotationDotEventTarget(e) { | ||
| const t = e.target; | ||
| return t instanceof Element && t.closest(".forge-annotation-dot") !== null; | ||
| } | ||
| handleKeyDown = (e) => { | ||
@@ -631,8 +625,8 @@ if (e.key === "Escape") { | ||
| createAnnotationFromElements(e, t, n, o, i) { | ||
| const s = i || ae(); | ||
| const s = i || ie(); | ||
| this.hoverSuppressed = !0, this.removeHoverOverlay(); | ||
| const a = e.map((f) => this.elementToInfo(f)), l = a.map((f) => ({ xpath: b(f.xpath), forgeId: f.forgeId, forgeIdIndex: f.forgeIdIndex })), h = this.getAnchorRect(l), d = n - 2, m = o - H - 2, p = h && h.width > 0 && h.height > 0 ? { x: (d - h.left) / h.width, y: (m - h.top) / h.height } : { x: 0, y: 0 }; | ||
| const a = e.map((p) => this.elementToInfo(p)), l = a.map((p) => ({ xpath: I(p.xpath), forgeId: p.forgeId, forgeIdIndex: p.forgeIdIndex })), h = this.getAnchorRect(l), d = n - 2, m = o - N - 2, f = h && h.width > 0 && h.height > 0 ? { x: (d - h.left) / h.width, y: (m - h.top) / h.height } : { x: 0, y: 0 }; | ||
| this.pendingAnnotations.set(s, { dotX: n, dotY: o, mode: t, locators: l }), this.clearDragHighlights(), this.highlightLocators(l, t === "multi"); | ||
| const g = a[0], y = { id: s, dotX: n, dotY: o, anchorOffset: p, mode: t, elements: a, xpaths: a.map((f) => b(f.xpath)), elementTag: g.elementTag, componentName: g.componentName, componentPath: g.componentPath, forgeId: g.forgeId, sourcePos: g.sourcePos }; | ||
| c("annotation", "Annotation created (pending):", y), this.messenger.send({ type: "ANNOTATION_CREATED", annotation: y, origin: O }); | ||
| const g = a[0], y = { id: s, dotX: n, dotY: o, anchorOffset: f, mode: t, elements: a, xpaths: a.map((p) => I(p.xpath)), elementTag: g.elementTag, componentName: g.componentName, componentPath: g.componentPath, forgeId: g.forgeId, sourcePos: g.sourcePos }; | ||
| c("annotation", "Annotation created (pending):", y), this.messenger.send({ type: "ANNOTATION_CREATED", annotation: y, origin: E }); | ||
| } | ||
@@ -643,13 +637,12 @@ handleDocumentLeave = () => { | ||
| addListeners() { | ||
| this.hitTestOverlay && (this.hitTestOverlay.addEventListener("mousemove", this.handleMouseMove), this.hitTestOverlay.addEventListener("mousedown", this.handleMouseDown), this.hitTestOverlay.addEventListener("mouseup", this.handleMouseUp), this.hitTestOverlay.addEventListener("click", this.handleClick), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp), document.addEventListener("mouseleave", this.handleDocumentLeave)); | ||
| document.addEventListener("mousemove", this.handleMouseMove, !0), document.addEventListener("mousedown", this.handleMouseDown, !0), document.addEventListener("mouseup", this.handleMouseUp, !0), document.addEventListener("click", this.handleClick, !0), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp), document.addEventListener("mouseleave", this.handleDocumentLeave); | ||
| } | ||
| removeListeners() { | ||
| this.hitTestOverlay && (this.hitTestOverlay.removeEventListener("mousemove", this.handleMouseMove), this.hitTestOverlay.removeEventListener("mousedown", this.handleMouseDown), this.hitTestOverlay.removeEventListener("mouseup", this.handleMouseUp), this.hitTestOverlay.removeEventListener("click", this.handleClick)), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp), document.removeEventListener("mouseleave", this.handleDocumentLeave); | ||
| document.removeEventListener("mousemove", this.handleMouseMove, !0), document.removeEventListener("mousedown", this.handleMouseDown, !0), document.removeEventListener("mouseup", this.handleMouseUp, !0), document.removeEventListener("click", this.handleClick, !0), document.removeEventListener("keydown", this.handleKeyDown), document.removeEventListener("keyup", this.handleKeyUp), document.removeEventListener("mouseleave", this.handleDocumentLeave); | ||
| } | ||
| } | ||
| class le { | ||
| class se { | ||
| messenger; | ||
| callbacks; | ||
| hitTestOverlay = null; | ||
| hoveredElement = null; | ||
| selectModeShield = null; | ||
| constructor(e, t) { | ||
@@ -659,9 +652,27 @@ this.messenger = e, this.callbacks = t; | ||
| enableListeners() { | ||
| this.hitTestOverlay = ie(), this.hitTestOverlay.addEventListener("mousemove", this.handleMouseOver), this.hitTestOverlay.addEventListener("mouseout", this.handleMouseOut), this.hitTestOverlay.addEventListener("click", this.handleClick), document.addEventListener("scroll", this.handleScroll, !0); | ||
| this.attachSelectModeShieldIfNeeded(), document.addEventListener("mousemove", this.handleMouseOver, !0), document.addEventListener("click", this.handleClick, !0), document.addEventListener("mouseleave", this.handleMouseOut), document.addEventListener("scroll", this.handleScroll, !0); | ||
| } | ||
| disableListeners() { | ||
| this.hitTestOverlay && (this.hitTestOverlay.removeEventListener("mousemove", this.handleMouseOver), this.hitTestOverlay.removeEventListener("mouseout", this.handleMouseOut), this.hitTestOverlay.removeEventListener("click", this.handleClick)), document.removeEventListener("scroll", this.handleScroll, !0), se(), this.hitTestOverlay = null; | ||
| this.removeSelectModeShield(), document.removeEventListener("mousemove", this.handleMouseOver, !0), document.removeEventListener("click", this.handleClick, !0), document.removeEventListener("mouseleave", this.handleMouseOut), document.removeEventListener("scroll", this.handleScroll, !0), this.clearHover(); | ||
| } | ||
| attachSelectModeShieldIfNeeded() { | ||
| if (!this.callbacks.getSelectMode() || this.callbacks.getDesignMode() || this.selectModeShield) return; | ||
| const e = document.createElement("div"); | ||
| Object.assign(e.style, { position: "fixed", top: "0", left: "0", width: "100%", height: "100%", backgroundColor: "transparent", pointerEvents: "auto", zIndex: "9998", cursor: "crosshair" }), e.className = "forge-select-mode-shield", e.addEventListener("wheel", this.handleShieldWheel, { passive: !1 }), document.body.appendChild(e), this.selectModeShield = e; | ||
| } | ||
| removeSelectModeShield() { | ||
| this.selectModeShield && (this.selectModeShield.removeEventListener("wheel", this.handleShieldWheel), this.selectModeShield.remove(), this.selectModeShield = null); | ||
| } | ||
| handleShieldWheel = (e) => { | ||
| if (!this.callbacks.getSelectMode() || this.callbacks.getDesignMode()) return; | ||
| e.preventDefault(); | ||
| const t = this.resolveElementFromPoint(e.clientX, e.clientY), n = t instanceof HTMLElement ? t : null, o = n ? this.findScrollableAncestor(n, e.deltaX, e.deltaY) : null; | ||
| if (o) { | ||
| o.scrollBy({ left: e.deltaX, top: e.deltaY, behavior: "auto" }); | ||
| return; | ||
| } | ||
| window.scrollBy({ left: e.deltaX, top: e.deltaY, behavior: "auto" }); | ||
| }; | ||
| clearHover() { | ||
| this.hoveredElement = null, R(); | ||
| M(); | ||
| } | ||
@@ -680,54 +691,75 @@ findTopmostElementWithSameId(e) { | ||
| handleSelectModeClick(e) { | ||
| const t = b(M(e)); | ||
| c("client", "Element clicked, XPath:", t), this.messenger.send({ type: "XPATH_REPORT", xpath: t, origin: O }), this.messenger.send({ type: "SELECT_MODE_DISABLED", origin: O }); | ||
| const t = I(R(e)); | ||
| c("client", "Element clicked, XPath:", t), this.messenger.send({ type: "XPATH_REPORT", xpath: t, origin: E }), this.messenger.send({ type: "SELECT_MODE_DISABLED", origin: E }); | ||
| } | ||
| handleMouseOver = (e) => { | ||
| if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode() || this.callbacks.getHoverDisabled()) return; | ||
| this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none"); | ||
| const t = document.elementFromPoint(e.clientX, e.clientY); | ||
| if (this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "auto"), t && t !== document.body && t !== document.documentElement) { | ||
| const t = this.resolveTarget(e); | ||
| if (t && t !== document.body && t !== document.documentElement) { | ||
| const o = t.getAttribute("data-forge-id") ? this.findTopmostElementWithSameId(t) : t; | ||
| if (this.callbacks.getDesignMode() && o === this.callbacks.getSelectedDesignElement()) | ||
| return; | ||
| this.hoveredElement = o, oe(o); | ||
| ne(o); | ||
| } | ||
| }; | ||
| handleMouseOut = (e) => { | ||
| if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode()) return; | ||
| e.target === this.hoveredElement && (this.hoveredElement = null, R()); | ||
| !this.callbacks.getSelectMode() && !this.callbacks.getDesignMode() || M(); | ||
| }; | ||
| handleClick = (e) => { | ||
| if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode()) return; | ||
| e.preventDefault(), e.stopPropagation(), this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none"); | ||
| const t = document.elementFromPoint(e.clientX, e.clientY); | ||
| this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "auto"), t && t !== document.body && t !== document.documentElement && (this.callbacks.getSelectMode() && this.callbacks.onSelectClick(t), this.callbacks.getDesignMode() && (R(), this.hoveredElement = null, this.callbacks.onDesignClick(t))); | ||
| e.preventDefault(), e.stopPropagation(); | ||
| const t = this.resolveTarget(e); | ||
| t && t !== document.body && t !== document.documentElement && (this.callbacks.getSelectMode() && this.callbacks.onSelectClick(t), this.callbacks.getDesignMode() && (M(), this.callbacks.onDesignClick(t))); | ||
| }; | ||
| resolveTarget(e) { | ||
| const n = this.resolveElementFromPoint(e.clientX, e.clientY) ?? e.target; | ||
| return !n || !(n instanceof Element) ? null : n instanceof HTMLElement || n instanceof SVGElement ? n : null; | ||
| } | ||
| resolveElementFromPoint(e, t) { | ||
| const n = document.elementsFromPoint(e, t); | ||
| for (const o of n) | ||
| if (!(this.selectModeShield && o === this.selectModeShield) && !o.classList.contains("forge-overlay")) | ||
| return o; | ||
| return null; | ||
| } | ||
| findScrollableAncestor(e, t, n) { | ||
| let o = e; | ||
| for (; o && o !== document.body; ) { | ||
| if (this.canElementScroll(o, t, n)) return o; | ||
| o = o.parentElement; | ||
| } | ||
| return null; | ||
| } | ||
| canElementScroll(e, t, n) { | ||
| const o = window.getComputedStyle(e), i = (o.overflowY === "auto" || o.overflowY === "scroll" || o.overflowY === "overlay") && e.scrollHeight > e.clientHeight, s = (o.overflowX === "auto" || o.overflowX === "scroll" || o.overflowX === "overlay") && e.scrollWidth > e.clientWidth, a = i && (n < 0 && e.scrollTop > 0 || n > 0 && e.scrollTop + e.clientHeight < e.scrollHeight), l = s && (t < 0 && e.scrollLeft > 0 || t > 0 && e.scrollLeft + e.clientWidth < e.scrollWidth); | ||
| return a || l; | ||
| } | ||
| handleScroll = () => { | ||
| (this.callbacks.getSelectMode() || this.callbacks.getDesignMode()) && (this.hoveredElement = null, R()); | ||
| (this.callbacks.getSelectMode() || this.callbacks.getDesignMode()) && M(); | ||
| }; | ||
| } | ||
| let w = null, _ = null, P = null; | ||
| async function ce() { | ||
| if (w && _ && P) return; | ||
| let w = null, H = null, _ = null; | ||
| async function re() { | ||
| if (w && H && _) return; | ||
| const [r, e, t] = await Promise.all([import("@babel/parser"), import("@babel/traverse"), import("@babel/generator")]); | ||
| w = r.parse; | ||
| const n = e.default; | ||
| _ = typeof n == "function" ? n : n.default; | ||
| H = typeof n == "function" ? n : n.default; | ||
| const o = t.default; | ||
| P = typeof o == "function" ? o : o.default; | ||
| _ = typeof o == "function" ? o : o.default; | ||
| } | ||
| function F(r) { | ||
| function k(r) { | ||
| return typeof r == "boolean" ? { type: "JSXExpressionContainer", expression: { type: "BooleanLiteral", value: r, loc: null }, loc: null } : typeof r == "number" ? { type: "JSXExpressionContainer", expression: { type: "NumericLiteral", value: r, loc: null }, loc: null } : { type: "StringLiteral", value: String(r), loc: null }; | ||
| } | ||
| function $(r, e, t) { | ||
| function F(r, e, t) { | ||
| const n = r.node.attributes.find((o) => o.type === "JSXAttribute" && o.name.type === "JSXIdentifier" && o.name.name === e); | ||
| return n && n.type === "JSXAttribute" ? (n.value = F(t), !0) : (r.node.attributes.push({ type: "JSXAttribute", name: { type: "JSXIdentifier", name: e }, value: F(t), loc: null }), !0); | ||
| return n && n.type === "JSXAttribute" ? (n.value = k(t), !0) : (r.node.attributes.push({ type: "JSXAttribute", name: { type: "JSXIdentifier", name: e }, value: k(t), loc: null }), !0); | ||
| } | ||
| async function he(r, e, t, n, o) { | ||
| async function ae(r, e, t, n, o) { | ||
| try { | ||
| if (await ce(), !w || !_ || !P) return r; | ||
| if (await re(), !w || !H || !_) return r; | ||
| const i = w(r, { sourceType: "module", plugins: ["jsx", "typescript"] }); | ||
| let s = !1; | ||
| const a = /* @__PURE__ */ new Map(); | ||
| if (_(i, { JSXOpeningElement(l) { | ||
| if (H(i, { JSXOpeningElement(l) { | ||
| if (l.node.name.type !== "JSXIdentifier") return; | ||
@@ -738,4 +770,4 @@ const h = l.node.loc; | ||
| a.set(d, l); | ||
| const m = l.node.attributes.find((p) => p.type === "JSXAttribute" && p.name.type === "JSXIdentifier" && p.name.name === "data-forge-id" && p.value?.type === "StringLiteral"); | ||
| m && m.type === "JSXAttribute" && m.value.value === e && (s = $(l, t, n)); | ||
| const m = l.node.attributes.find((f) => f.type === "JSXAttribute" && f.name.type === "JSXIdentifier" && f.name.name === "data-forge-id" && f.value?.type === "StringLiteral"); | ||
| m && m.type === "JSXAttribute" && m.value.value === e && (s = F(l, t, n)); | ||
| } }), !s && o) { | ||
@@ -745,7 +777,7 @@ const l = o.split(":"); | ||
| const h = `${l[l.length - 4]}:${l[l.length - 3]}`, d = a.get(h); | ||
| d && (s = $(d, t, n)); | ||
| d && (s = F(d, t, n)); | ||
| } | ||
| } | ||
| if (s) | ||
| return P(i, {}, r).code; | ||
| return _(i, {}, r).code; | ||
| } catch (i) { | ||
@@ -756,3 +788,3 @@ c("client", "Failed to parse/update AST:", i); | ||
| } | ||
| async function de(r) { | ||
| async function le(r) { | ||
| try { | ||
@@ -768,3 +800,3 @@ const e = await fetch(`/__forge-read-source?path=${r}`); | ||
| } | ||
| async function ue(r, e) { | ||
| async function ce(r, e) { | ||
| try { | ||
@@ -776,3 +808,3 @@ return await fetch("/__forge-update-source", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ filePath: r, source: e }) }), !0; | ||
| } | ||
| class ge { | ||
| class he { | ||
| messenger; | ||
@@ -800,4 +832,4 @@ componentRegistry; | ||
| this.clearSelection(), this.selectedElement = n, this.applyHighlight(n); | ||
| const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h = b(M(n)), d = this.componentRegistry.getEditableProps(s), m = this.extractPropValues(n, d); | ||
| c("client", "Element selected in design mode:", { forgeId: t, sourcePos: i, text: a, type: l, componentName: s, editableProps: d, propValues: m }), this.messenger.send({ type: "ELEMENT_SELECTED", forgeId: t, sourcePos: i || void 0, text: a, elementType: l, xpath: h, componentName: s, editableProps: d, propValues: m, origin: O }); | ||
| const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h = I(R(n)), d = this.componentRegistry.getEditableProps(s), m = this.extractPropValues(n, d); | ||
| c("client", "Element selected in design mode:", { forgeId: t, sourcePos: i, text: a, type: l, componentName: s, editableProps: d, propValues: m }), this.messenger.send({ type: "ELEMENT_SELECTED", forgeId: t, sourcePos: i || void 0, text: a, elementType: l, xpath: h, componentName: s, editableProps: d, propValues: m, origin: E }); | ||
| } | ||
@@ -825,7 +857,7 @@ updateText(e, t) { | ||
| c("client", `Updating property ${t} = ${n} for ${e} in ${a}`), this.sourceCache.delete(a); | ||
| const l = await de(a); | ||
| const l = await le(a); | ||
| if (!l) return; | ||
| this.sourceCache.set(a, l); | ||
| const h = this.selectedElement?.getAttribute("data-source-pos") ?? null, d = await he(l, e, t, n, h); | ||
| d !== l ? (this.sourceCache.set(a, d), c("client", `Updated source for ${a}`), await ue(a, d) && (c("client", `Source written to disk and HMR triggered for ${a}`), this.messenger.send({ type: "SOURCE_UPDATED", forgeId: e, source: d, filePath: a, origin: O }))) : c("client", `No source changes detected for ${a}`); | ||
| const h = this.selectedElement?.getAttribute("data-source-pos") ?? null, d = await ae(l, e, t, n, h); | ||
| d !== l ? (this.sourceCache.set(a, d), c("client", `Updated source for ${a}`), await ce(a, d) && (c("client", `Source written to disk and HMR triggered for ${a}`), this.messenger.send({ type: "SOURCE_UPDATED", forgeId: e, source: d, filePath: a, origin: E }))) : c("client", `No source changes detected for ${a}`); | ||
| } | ||
@@ -860,3 +892,3 @@ applyHighlight(e) { | ||
| } | ||
| class C { | ||
| class A { | ||
| static instance = null; | ||
@@ -875,6 +907,6 @@ messenger; | ||
| constructor(e) { | ||
| this.onError = e?.onError, c("client", "ForgeClient initialized"), this.messenger = new V(), this.componentRegistry = new z(), this.selectController = new le(this.messenger, { getSelectMode: () => this.selectMode, getDesignMode: () => this.designMode, getHoverDisabled: () => this.hoverDisabled, getSelectedDesignElement: () => this.designController.getSelectedElement(), onSelectClick: (t) => this.handleSelectClick(t), onDesignClick: (t) => this.handleDesignClick(t) }), this.designController = new ge(this.messenger, this.componentRegistry, this.selectController), this.setupMessageListener(), this.sendReady(), this.setupForgeIdPropagation(), window.__forgeClient = this; | ||
| this.onError = e?.onError, c("client", "ForgeClient initialized"), this.messenger = new W(), this.componentRegistry = new j(), this.selectController = new se(this.messenger, { getSelectMode: () => this.selectMode, getDesignMode: () => this.designMode, getHoverDisabled: () => this.hoverDisabled, getSelectedDesignElement: () => this.designController.getSelectedElement(), onSelectClick: (t) => this.handleSelectClick(t), onDesignClick: (t) => this.handleDesignClick(t) }), this.designController = new he(this.messenger, this.componentRegistry, this.selectController), this.setupMessageListener(), this.sendReady(), this.setupForgeIdPropagation(), window.__forgeClient = this; | ||
| } | ||
| static getInstance(e) { | ||
| return C.instance || (C.instance = new C(e)), C.instance; | ||
| return A.instance || (A.instance = new A(e)), A.instance; | ||
| } | ||
@@ -885,9 +917,9 @@ enableAnnotationMode(e) { | ||
| restoreAnnotations(e) { | ||
| this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.annotationOverlay.restoreDots(e); | ||
| this.annotationOverlay || (this.annotationOverlay = new T(this.messenger)), this.annotationOverlay.restoreDots(e); | ||
| } | ||
| setupMessageListener() { | ||
| c("client", "Setting up message listener..."), this.messenger.onMessage((e) => { | ||
| if (W(e.data) || !e.data || typeof e.data != "object" || !("origin" in e.data)) return; | ||
| if (G(e.data) || !e.data || typeof e.data != "object" || !("origin" in e.data)) return; | ||
| const t = e.data; | ||
| if (t.origin === j) { | ||
| if (t.origin === V) { | ||
| this.isConnectedToHost || (this.isConnectedToHost = !0, this.readyIntervalId !== null && (window.clearInterval(this.readyIntervalId), this.readyIntervalId = null, c("client", "Host connection detected, stopped CHILD_READY retries"))), c("client", "Received message from host:", t); | ||
@@ -939,3 +971,3 @@ try { | ||
| case "RESTORE_ANNOTATIONS": | ||
| this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.annotationOverlay.restoreDots(t.annotations); | ||
| this.annotationOverlay || (this.annotationOverlay = new T(this.messenger)), this.annotationOverlay.restoreDots(t.annotations); | ||
| break; | ||
@@ -959,3 +991,3 @@ case "PING": | ||
| setAnnotationMode(e) { | ||
| e ? (this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.setSelectMode(!1), this.setDesignMode(!1), this.annotationOverlay.activate()) : this.annotationOverlay?.deactivate(); | ||
| e ? (this.annotationOverlay || (this.annotationOverlay = new T(this.messenger)), this.setSelectMode(!1), this.setDesignMode(!1), this.annotationOverlay.activate()) : this.annotationOverlay?.deactivate(); | ||
| } | ||
@@ -970,3 +1002,3 @@ handleSelectClick(e) { | ||
| c("client", "Scheduling CHILD_READY message..."), setTimeout(() => { | ||
| this.isConnectedToHost || (c("client", "Sending CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: O }), this.readyIntervalId === null && (this.readyIntervalId = window.setInterval(() => { | ||
| this.isConnectedToHost || (c("client", "Sending CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: E }), this.readyIntervalId === null && (this.readyIntervalId = window.setInterval(() => { | ||
| if (this.isConnectedToHost) { | ||
@@ -976,5 +1008,5 @@ this.readyIntervalId !== null && (window.clearInterval(this.readyIntervalId), this.readyIntervalId = null); | ||
| } | ||
| c("client", "Retrying CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: O }); | ||
| }, k.CHILD_READY_RETRY_INTERVAL))); | ||
| }, k.CHILD_READY_DELAY); | ||
| c("client", "Retrying CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: E }); | ||
| }, P.CHILD_READY_RETRY_INTERVAL))); | ||
| }, P.CHILD_READY_DELAY); | ||
| } | ||
@@ -1008,6 +1040,6 @@ setupForgeIdPropagation() { | ||
| } | ||
| C.getInstance(); | ||
| A.getInstance(); | ||
| export { | ||
| C as ForgeClient, | ||
| V as ParentMessenger | ||
| A as ForgeClient, | ||
| W as ParentMessenger | ||
| }; |
| import type { ParentMessenger } from "../../shared/messaging.js"; | ||
| import type { AnnotationElementInfo, RestoreAnnotationData } from "../../shared/events.js"; | ||
| /** | ||
| * Full-screen overlay for creating and managing annotations. | ||
| * Annotation interaction layer for creating and managing annotations. | ||
| * Supports single-click (one element) and shift+drag (multi-element) selection. | ||
@@ -12,3 +12,2 @@ */ | ||
| private componentTooltip; | ||
| private hitTestOverlay; | ||
| private dragRect; | ||
@@ -59,4 +58,2 @@ private dragHighlights; | ||
| private repositionAll; | ||
| private createHitTestOverlay; | ||
| private removeHitTestOverlay; | ||
| private showHoverOverlay; | ||
@@ -96,2 +93,3 @@ private removeHoverOverlay; | ||
| private handleClick; | ||
| private isAnnotationDotEventTarget; | ||
| private handleKeyDown; | ||
@@ -98,0 +96,0 @@ private handleKeyUp; |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"AnnotationOverlay.d.ts","sourceRoot":"","sources":["../../../src/client/annotation/AnnotationOverlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEhE,OAAO,KAAK,EAAkB,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AA6B1G;;;GAGG;AACH,qBAAa,iBAAiB;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AAO,CAAC,gBAAgB;IA4BxB,OAAO,CAAC,oBAAoB;IAsC5B,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,mBAAmB;IA8D3B,yDAAyD;IACzD,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAYlD,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,0BAA0B;IAgBlC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;IA6CtB,OAAO,CAAC,eAAe,CAiCtB;IAED,OAAO,CAAC,MAAM,CAAC,cAAc,CAAI;IAEjC,OAAO,CAAC,eAAe,CAgBtB;IAED,OAAO,CAAC,aAAa,CA6CpB;IAED,OAAO,CAAC,WAAW,CAKlB;IAED,OAAO,CAAC,0BAA0B;IAKlC,OAAO,CAAC,aAAa,CAcpB;IAED,OAAO,CAAC,WAAW,CAElB;IAED,OAAO,CAAC,kBAAkB,CAA0G;IAEpI,kEAAkE;IAClE,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAUrD,gFAAgF;IAChF,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IAUzC,OAAO,CAAC,4BAA4B;IA8CpC,OAAO,CAAC,mBAAmB,CAE1B;IAED,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;CASxB"} |
@@ -10,9 +10,11 @@ import type { ParentMessenger } from "../../shared/messaging.js"; | ||
| private callbacks; | ||
| private hitTestOverlay; | ||
| private hoveredElement; | ||
| private selectModeShield; | ||
| constructor(messenger: ParentMessenger, callbacks: SelectModeCallbacks); | ||
| /** Creates the hit-test overlay and attaches mouse/scroll listeners. */ | ||
| /** Attaches capture-phase listeners for hover/click selection. */ | ||
| enableListeners(): void; | ||
| /** Removes listeners and the hit-test overlay. */ | ||
| /** Removes listeners and clears any active hover highlight. */ | ||
| disableListeners(): void; | ||
| private attachSelectModeShieldIfNeeded; | ||
| private removeSelectModeShield; | ||
| private handleShieldWheel; | ||
| /** Clears the current hover highlight. */ | ||
@@ -30,4 +32,8 @@ clearHover(): void; | ||
| private handleClick; | ||
| private resolveTarget; | ||
| private resolveElementFromPoint; | ||
| private findScrollableAncestor; | ||
| private canElementScroll; | ||
| private handleScroll; | ||
| } | ||
| //# sourceMappingURL=SelectModeController.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"SelectModeController.d.ts","sourceRoot":"","sources":["../../../src/client/select-mode/SelectModeController.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,cAAc,CAA2B;gBAErC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAmB;IAKtE,wEAAwE;IACxE,eAAe,IAAI,IAAI;IAQvB,kDAAkD;IAClD,gBAAgB,IAAI,IAAI;IAWxB,0CAA0C;IAC1C,UAAU,IAAI,IAAI;IAKlB;;;OAGG;IACH,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW;IAiB/D,yEAAyE;IACzE,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAShD,OAAO,CAAC,eAAe,CAmBtB;IAED,OAAO,CAAC,cAAc,CAOrB;IAED,OAAO,CAAC,WAAW,CAoBlB;IAED,OAAO,CAAC,YAAY,CAKnB;CACF"} | ||
| {"version":3,"file":"SelectModeController.d.ts","sourceRoot":"","sources":["../../../src/client/select-mode/SelectModeController.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE9D;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,gBAAgB,CAA8B;gBAE1C,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAmB;IAKtE,kEAAkE;IAClE,eAAe,IAAI,IAAI;IAQvB,+DAA+D;IAC/D,gBAAgB,IAAI,IAAI;IASxB,OAAO,CAAC,8BAA8B;IAsBtC,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,iBAAiB,CAexB;IAED,0CAA0C;IAC1C,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,4BAA4B,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW;IAiB/D,yEAAyE;IACzE,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAShD,OAAO,CAAC,eAAe,CAgBtB;IAED,OAAO,CAAC,cAAc,CAGrB;IAED,OAAO,CAAC,WAAW,CAiBlB;IAED,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,YAAY,CAInB;CACF"} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { T as c, W as h, a as i, i as d, M as E } from "./constants-DqGvo09s.js"; | ||
| import { T as c, W as h, a as i, i as d, M as E } from "./constants-DHvpLY46.js"; | ||
| import { d as n } from "./debug-CLzmqn3R.js"; | ||
@@ -3,0 +3,0 @@ class u { |
+1
-1
@@ -5,3 +5,3 @@ import { ForgeHost as r } from "./host.js"; | ||
| import { e as p } from "./debug-CLzmqn3R.js"; | ||
| import { a as E, M as g } from "./constants-DqGvo09s.js"; | ||
| import { a as E, M as g } from "./constants-DHvpLY46.js"; | ||
| export { | ||
@@ -8,0 +8,0 @@ t as ForgeClient, |
+1
-1
| { | ||
| "name": "@supernovaio/prototyping-tooling", | ||
| "version": "0.9.7-alpha.0", | ||
| "version": "0.9.7-alpha.1", | ||
| "description": "Prototyping Tooling — iframe communication bridge for design-to-code workflows", | ||
@@ -5,0 +5,0 @@ "type": "module", |
| function o(n) { | ||
| if (n && typeof n == "object" && "source" in n) { | ||
| const e = n.source; | ||
| return typeof e == "string" && e.includes("react-devtools"); | ||
| } | ||
| return !1; | ||
| } | ||
| class E { | ||
| targetWindow; | ||
| targetOrigin; | ||
| constructor(e, s = "*") { | ||
| this.targetWindow = e, this.targetOrigin = s; | ||
| } | ||
| send(e, s) { | ||
| this.targetWindow.postMessage(e, s || this.targetOrigin || "*"); | ||
| } | ||
| onMessage(e) { | ||
| const s = (t) => { | ||
| e(t); | ||
| }; | ||
| return window.addEventListener("message", s), () => { | ||
| window.removeEventListener("message", s); | ||
| }; | ||
| } | ||
| } | ||
| class a { | ||
| send(e, s) { | ||
| window.parent && window.parent !== window && window.parent.postMessage(e, s || "*"); | ||
| } | ||
| onMessage(e) { | ||
| const s = (t) => { | ||
| e(t); | ||
| }; | ||
| return window.addEventListener("message", s), () => { | ||
| window.removeEventListener("message", s); | ||
| }; | ||
| } | ||
| } | ||
| const r = "host", T = "sandbox", O = { HIT_TEST_OVERLAY: "9998", HOVER_OVERLAY: "9999", ANNOTATION_DOT: "10000", TOOLTIP: "10001" }, _ = { SELECT_OVERLAY_BORDER: "#1A58D0", SELECT_OVERLAY_BG: "#45ADFF17", DESIGN_SELECTION_OUTLINE: "#9333ea", ANNOTATION_SINGLE: "#1A58D0", ANNOTATION_MULTI: "#1A58D0", ANNOTATION_SINGLE_BG: "#45ADFF17", ANNOTATION_MULTI_BG: "#45ADFF17", DRAG_RECT_BG: "#45ADFF17" }, A = 20, N = 20, i = { CHILD_READY_DELAY: 1e3, CHILD_READY_RETRY_INTERVAL: 3e3, CONNECTION_TIMEOUT: 5e3 }, I = ["#root", "#app", "#__next", "[data-reactroot]"], c = 200, d = 30, L = 6; | ||
| export { | ||
| A as B, | ||
| _ as C, | ||
| T as M, | ||
| a as P, | ||
| I as R, | ||
| i as T, | ||
| E as W, | ||
| O as Z, | ||
| r as a, | ||
| L as b, | ||
| d as c, | ||
| c as d, | ||
| N as e, | ||
| o as i | ||
| }; |
126772
0.88%2148
1.51%