@supernovaio/prototyping-tooling 0.9.7-alpha.0 → 0.9.7-alpha.2

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.
@@ -5,33 +5,33 @@ import { relative as F } from "node:path";
5
5
  const E = typeof y == "function" ? y : y.default, M = typeof S == "function" ? S : S.default;
6
6
  function T(d) {
7
7
  let r = 0;
8
- for (let c = 0; c < d.length; c++) {
9
- const s = d.charCodeAt(c);
8
+ for (let f = 0; f < d.length; f++) {
9
+ const s = d.charCodeAt(f);
10
10
  r = (r << 5) - r + s, r = r & r;
11
11
  }
12
12
  return Math.abs(r).toString(36).substring(0, 8);
13
13
  }
14
- function B(d = {}) {
15
- const { prefix: r = "forge" } = d, c = (s, i, u) => {
16
- const a = T(`${s}:${i}:${u}`);
17
- return `${r}-${a}-${i}-${u}`;
14
+ function k(d = {}) {
15
+ const { prefix: r = "forge" } = d, f = (s, i, u) => {
16
+ const o = T(`${s}:${i}:${u}`);
17
+ return `${r}-${o}-${i}-${u}`;
18
18
  };
19
19
  return { name: "forge-id-plugin", enforce: "pre", transform(s, i) {
20
20
  if (!i.match(/\.(tsx?|jsx?)$/) || i.includes("node_modules"))
21
21
  return null;
22
22
  const u = F(process.cwd(), i).replace(/\\/g, "/");
23
23
  try {
24
- let a = function(e) {
24
+ let o = function(e) {
25
25
  const n = e.parent;
26
26
  if (n.type === "VariableDeclarator" && n.id.type === "Identifier" && /^[A-Z]/.test(n.id.name))
27
27
  return !0;
28
28
  if (n.type === "CallExpression") {
29
29
  const l = e.parentPath;
30
30
  if (l) {
31
- const f = l.parent;
32
- if (f.type === "VariableDeclarator" && f.id.type === "Identifier" && /^[A-Z]/.test(f.id.name) || f.type === "ExportDefaultDeclaration")
31
+ const c = l.parent;
32
+ if (c.type === "VariableDeclarator" && c.id.type === "Identifier" && /^[A-Z]/.test(c.id.name) || c.type === "ExportDefaultDeclaration")
33
33
  return !0;
34
- if (f.type === "CallExpression") {
34
+ if (c.type === "CallExpression") {
35
35
  const p = l.parentPath;
36
36
  if (p) {
37
37
  const t = p.parent;
@@ -43,54 +43,56 @@ function B(d = {}) {
43
43
  }
44
44
  return !1;
45
45
  };
46
- const x = P(s, { sourceType: "module", plugins: ["jsx", "typescript"] }), J = /* @__PURE__ */ new Set();
47
- let b = !1, o = 0;
46
+ const x = P(s, { sourceType: "module", plugins: ["jsx", "typescript"] }), C = /* @__PURE__ */ new Set();
47
+ let b = !1, a = 0;
48
48
  if (E(x, { FunctionDeclaration: { enter(e) {
49
- e.node.id && /^[A-Z]/.test(e.node.id.name) && o++;
49
+ e.node.id && /^[A-Z]/.test(e.node.id.name) && a++;
50
50
  }, exit(e) {
51
- e.node.id && /^[A-Z]/.test(e.node.id.name) && o--;
51
+ e.node.id && /^[A-Z]/.test(e.node.id.name) && a--;
52
52
  } }, ArrowFunctionExpression: { enter(e) {
53
- a(e) && o++;
53
+ o(e) && a++;
54
54
  }, exit(e) {
55
- a(e) && o--;
55
+ o(e) && a--;
56
56
  } }, FunctionExpression: { enter(e) {
57
- a(e) && o++;
57
+ o(e) && a++;
58
58
  }, exit(e) {
59
- a(e) && o--;
59
+ o(e) && a--;
60
60
  } }, JSXOpeningElement(e) {
61
61
  if (e.node.name.type === "JSXIdentifier") {
62
62
  const n = e.node.name.name, l = /^[A-Z]/.test(n);
63
63
  if (n === "Fragment" || n === "React.Fragment" || (/* @__PURE__ */ new Set(["path", "circle", "rect", "line", "polyline", "polygon", "ellipse", "g", "defs", "clipPath", "mask", "use", "text", "tspan", "textPath", "image", "pattern", "linearGradient", "radialGradient", "stop", "filter", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feFlood", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "feSpecularLighting", "feTile", "feTurbulence", "marker", "symbol", "foreignObject", "desc", "title", "metadata"])).has(n))
64
64
  return;
65
- if (l && o > 0) {
65
+ if (l && a > 0) {
66
66
  const t = e.scope.getBinding(n);
67
- if (t && t.scope.path.type !== "Program")
67
+ if (t && t.scope.path.type !== "Program") {
68
+ console.log(`[Plugin] Skipping ${n} - locally-scoped dynamic component inside definition`);
68
69
  return;
70
+ }
69
71
  }
70
72
  if (!e.node.attributes.some((t) => t.type === "JSXAttribute" && t.name.type === "JSXIdentifier" && t.name.name === "data-forge-id")) {
71
73
  const t = e.node.loc?.start;
72
74
  if (!t) return;
73
75
  const I = e.parent, m = I.type === "JSXElement" ? I.loc?.end : e.node.loc?.end;
74
76
  if (!m) return;
75
- const A = c(i, t.line, t.column), v = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-forge-id" }, value: { type: "StringLiteral", value: A }, loc: e.node.loc }, h = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-component" }, value: { type: "StringLiteral", value: n }, loc: e.node.loc }, C = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-source-pos" }, value: { type: "StringLiteral", value: `${u}:${t.line}:${t.column}:${m.line}:${m.column}` }, loc: e.node.loc }, X = !l && o > 0, $ = e.node.attributes.some((g) => g.type === "JSXSpreadAttribute");
76
- if (X && $) {
77
+ const A = f(i, t.line, t.column), v = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-forge-id" }, value: { type: "StringLiteral", value: A }, loc: e.node.loc }, $ = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-component" }, value: { type: "StringLiteral", value: n }, loc: e.node.loc }, h = { type: "JSXAttribute", name: { type: "JSXIdentifier", name: "data-source-pos" }, value: { type: "StringLiteral", value: `${u}:${t.line}:${t.column}:${m.line}:${m.column}` }, loc: e.node.loc }, J = !l && a > 0, X = e.node.attributes.some((g) => g.type === "JSXSpreadAttribute");
78
+ if (J && X) {
77
79
  const g = e.node.attributes.findIndex((D) => D.type === "JSXSpreadAttribute");
78
- e.node.attributes.splice(g, 0, v, h, C);
80
+ e.node.attributes.splice(g, 0, v, $, h);
79
81
  } else
80
- e.node.attributes.push(v, h, C);
81
- J.add(A), b = !0;
82
+ e.node.attributes.push(v, $, h);
83
+ C.add(A), b = !0;
82
84
  }
83
85
  }
84
86
  } }), b) {
85
87
  const e = M(x, {}, s);
86
88
  return { code: e.code, map: e.map };
87
89
  }
88
- } catch {
89
- return null;
90
+ } catch (o) {
91
+ return o instanceof Error && console.warn(`Failed to parse ${i} for forge-id injection: ${o.message}`), null;
90
92
  }
91
93
  return null;
92
94
  } };
93
95
  }
94
96
  export {
95
- B as supernovaDesignPlugin
97
+ k as supernovaDesignPlugin
96
98
  };
@@ -1,7 +1,7 @@
1
1
  import type { ParentMessenger } from "../../shared/messaging.js";
2
2
  import type { AnnotationElementInfo, RestoreAnnotationData } from "../../shared/events.js";
3
3
  /**
4
- * Full-screen overlay for creating and managing annotations.
4
+ * Annotation interaction layer for creating and managing annotations.
5
5
  * Supports single-click (one element) and shift+drag (multi-element) selection.
6
6
  */
7
7
  export declare class AnnotationOverlay {
@@ -9,7 +9,6 @@ export declare class AnnotationOverlay {
9
9
  private messenger;
10
10
  private hoverOverlay;
11
11
  private componentTooltip;
12
- private hitTestOverlay;
13
12
  private dragRect;
14
13
  private dragHighlights;
15
14
  private annotationHighlights;
@@ -55,8 +54,6 @@ export declare class AnnotationOverlay {
55
54
  setMarkersVisible(visible: boolean): void;
56
55
  /** Repositions all badge dots and visible highlights to follow their anchored elements. */
57
56
  private repositionAll;
58
- private createHitTestOverlay;
59
- private removeHitTestOverlay;
60
57
  private showHoverOverlay;
61
58
  private removeHoverOverlay;
62
59
  private repositionHoverOverlay;
@@ -91,6 +88,7 @@ export declare class AnnotationOverlay {
91
88
  private handleMouseDown;
92
89
  private handleMouseUp;
93
90
  private handleClick;
91
+ private isAnnotationDotEventTarget;
94
92
  private handleKeyDown;
95
93
  private handleKeyUp;
96
94
  private pendingAnnotations;
@@ -1 +1 @@
1
- {"version":3,"file":"AnnotationOverlay.d.ts","sourceRoot":"","sources":["../../../src/client/annotation/AnnotationOverlay.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import type { ForgeClientOptions } from "./types.js";
8
8
  * and AnnotationOverlay based on messages from the host.
9
9
  */
10
10
  export declare class ForgeClient {
11
+ private static readonly ANNOTATION_CURSOR_LOCK_CLASS;
11
12
  private static instance;
12
13
  private messenger;
13
14
  private readyIntervalId;
@@ -19,6 +20,7 @@ export declare class ForgeClient {
19
20
  private annotationOverlay;
20
21
  private selectController;
21
22
  private designController;
23
+ private annotationCursorLockStyleEl;
22
24
  private onError?;
23
25
  private constructor();
24
26
  /** Returns the singleton ForgeClient instance, creating it if necessary. */
@@ -31,6 +33,8 @@ export declare class ForgeClient {
31
33
  private setSelectMode;
32
34
  private setDesignMode;
33
35
  private setAnnotationMode;
36
+ private enableAnnotationCursorLock;
37
+ private disableAnnotationCursorLock;
34
38
  private handleSelectClick;
35
39
  private handleDesignClick;
36
40
  private sendReady;
@@ -1 +1 @@
1
- {"version":3,"file":"ForgeClient.d.ts","sourceRoot":"","sources":["../../../src/client/general/ForgeClient.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAOhH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD;;;;;;GAMG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA2B;IAClD,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,iBAAiB,CAAQ;IACjC,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,iBAAiB,CAAmB;IAC5C,OAAO,CAAC,iBAAiB,CAAiC;IAC1D,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,OAAO,CAAC,CAAwB;IAExC,OAAO;IA4BP,4EAA4E;IAC5E,MAAM,CAA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OAAO;IA4BP,4EAA4E;IAC5E,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,WAAW;IAO7D,6FAA6F;IAC7F,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI5C,2FAA2F;IAC3F,kBAAkB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAS9D,OAAO,CAAC,oBAAoB;IA2F5B,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,0BAA0B;IAgBlC,OAAO,CAAC,2BAA2B;IASnC,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,SAAS;IAwBjB,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,yBAAyB;CAkBlC"}
@@ -7,12 +7,10 @@ import type { SelectModeCallbacks } from "../general/types.js";
7
7
  export declare class SelectModeController {
8
8
  private messenger;
9
9
  private callbacks;
10
- private hitTestOverlay;
11
- private hoveredElement;
12
10
  constructor(messenger: ParentMessenger, callbacks: SelectModeCallbacks);
13
- /** Creates the hit-test overlay and attaches mouse/scroll listeners. */
11
+ /** Attaches capture-phase listeners for hover/click selection. */
14
12
  enableListeners(): void;
15
- /** Removes listeners and the hit-test overlay. */
13
+ /** Removes listeners and clears any active hover highlight. */
16
14
  disableListeners(): void;
17
15
  /** Clears the current hover highlight. */
18
16
  clearHover(): void;
@@ -26,6 +24,8 @@ export declare class SelectModeController {
26
24
  private handleMouseOver;
27
25
  private handleMouseOut;
28
26
  private handleClick;
27
+ private resolveTarget;
28
+ private resolveElementFromPoint;
29
29
  private handleScroll;
30
30
  }
31
31
  //# sourceMappingURL=SelectModeController.d.ts.map
@@ -1 +1 @@
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"}
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;gBAE1B,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,mBAAmB;IAKtE,kEAAkE;IAClE,eAAe,IAAI,IAAI;IAOvB,+DAA+D;IAC/D,gBAAgB,IAAI,IAAI;IAQxB,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;IAS/B,OAAO,CAAC,YAAY,CAInB;CACF"}
package/dist/client.js CHANGED
@@ -1,6 +1,6 @@
1
- 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";
2
- import { d as c } from "./debug-CLzmqn3R.js";
3
- class z {
1
+ import { b as $, c as X, R as Y, d as U, Z as x, C as v, M as A, B as R, e as B, P as G, i as W, a as V, T as P } from "./constants-DHvpLY46.js";
2
+ import { d as c } from "./debug-BuKzUOMn.js";
3
+ class j {
4
4
  registry = /* @__PURE__ */ new Map();
5
5
  register(e, t) {
6
6
  this.registry.set(e, t);
@@ -38,44 +38,44 @@ function M(r) {
38
38
  }
39
39
  return e;
40
40
  }
41
- function b(r) {
41
+ function I(r) {
42
42
  return r.length === 1 && r[0].startsWith("*[@id=") ? `//${r[0]}` : "/" + r.join("/");
43
43
  }
44
- 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$/];
45
- let T = null;
46
- function x(r) {
44
+ 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"]), z = [/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$/];
45
+ let C = null;
46
+ function T(r) {
47
47
  const e = (t) => t.some((n) => n.startsWith("__reactFiber$") || n.startsWith("__reactInternalInstance$") || n.startsWith("__reactProps$"));
48
48
  return e(Object.keys(r)) || e(Object.getOwnPropertyNames(r));
49
49
  }
50
- function q() {
51
- if (T !== null) return T;
50
+ function J() {
51
+ if (C !== null) return C;
52
52
  if (typeof document > "u") return !1;
53
- if (document.body && x(document.body))
54
- return c("client", "Detected React on document.body"), T = !0, !0;
55
- for (const e of U) {
53
+ if (document.body && T(document.body))
54
+ return c("client", "Detected React on document.body"), C = !0, !0;
55
+ for (const e of Y) {
56
56
  const t = document.querySelector(e);
57
57
  if (t) {
58
- if (x(t))
59
- return c("client", "Detected React on", e), T = !0, !0;
58
+ if (T(t))
59
+ return c("client", "Detected React on", e), C = !0, !0;
60
60
  for (const n of t.children)
61
- if (x(n))
62
- return c("client", "Detected React on child of", e), T = !0, !0;
61
+ if (T(n))
62
+ return c("client", "Detected React on child of", e), C = !0, !0;
63
63
  }
64
64
  }
65
65
  if (document.body) {
66
66
  for (const e of document.body.children)
67
- if (x(e))
68
- return c("client", "Detected React on body child:", e.tagName), T = !0, !0;
67
+ if (T(e))
68
+ return c("client", "Detected React on body child:", e.tagName), C = !0, !0;
69
69
  }
70
70
  const r = document.querySelectorAll("*");
71
71
  for (const e of r) {
72
- if (x(e))
73
- return c("client", "Detected React on deep scan:", e.tagName), T = !0, !0;
74
- if (r.length > B) break;
72
+ if (T(e))
73
+ return c("client", "Detected React on deep scan:", e.tagName), C = !0, !0;
74
+ if (r.length > U) break;
75
75
  }
76
- return c("client", "React NOT detected on page"), T = !1, !1;
76
+ return c("client", "React NOT detected on page"), C = !1, !1;
77
77
  }
78
- function Z(r) {
78
+ function q(r) {
79
79
  const e = Object.keys(r);
80
80
  let t = e.find((s) => s.startsWith("__reactFiber$"));
81
81
  if (t) return r[t] || null;
@@ -91,27 +91,27 @@ function Z(r) {
91
91
  });
92
92
  return i && r[i] || null;
93
93
  }
94
- function I(r) {
94
+ function b(r) {
95
95
  return r ? r.displayName ? r.displayName : r.name ? r.name : null : null;
96
96
  }
97
- function Q(r) {
97
+ function Z(r) {
98
98
  const { tag: e, type: t, elementType: n } = r;
99
99
  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;
100
100
  if (e === u.ForwardRef) {
101
101
  const i = n;
102
102
  if (i?.render) {
103
- const s = I(i.render);
103
+ const s = b(i.render);
104
104
  if (s) return s;
105
105
  }
106
- return i?.displayName ? i.displayName : I(t);
106
+ return i?.displayName ? i.displayName : b(t);
107
107
  }
108
108
  if (e === u.MemoComponent || e === u.SimpleMemoComponent) {
109
109
  const i = n;
110
110
  if (i?.type) {
111
- const s = I(i.type);
111
+ const s = b(i.type);
112
112
  if (s) return s;
113
113
  }
114
- return i?.displayName ? i.displayName : I(t);
114
+ return i?.displayName ? i.displayName : b(t);
115
115
  }
116
116
  if (e === u.ContextProvider) {
117
117
  const i = t;
@@ -123,60 +123,53 @@ function Q(r) {
123
123
  }
124
124
  if (e === u.LazyComponent) {
125
125
  const i = n;
126
- return i?._status === 1 && i._result ? I(i._result) : null;
126
+ return i?._status === 1 && i._result ? b(i._result) : null;
127
127
  }
128
- return e === u.IncompleteClassComponent || e === u.IncompleteFunctionComponent || e === u.FunctionComponent || e === u.ClassComponent || e === u.IndeterminateComponent ? I(t) : null;
128
+ return e === u.IncompleteClassComponent || e === u.IncompleteFunctionComponent || e === u.FunctionComponent || e === u.ClassComponent || e === u.IndeterminateComponent ? b(t) : null;
129
129
  }
130
- function ee(r) {
130
+ function Q(r) {
131
131
  return r.length <= 2 || r.length <= 3 && r === r.toLowerCase();
132
132
  }
133
- function te(r) {
134
- return !(K.has(r) || J.some((e) => e.test(r)));
133
+ function ee(r) {
134
+ return !(K.has(r) || z.some((e) => e.test(r)));
135
135
  }
136
- function ne(r, e = X, t = Y) {
137
- if (!q())
136
+ function te(r, e = $, t = X) {
137
+ if (!J())
138
138
  return c("client", "isReactPage() = false"), { path: null, components: [] };
139
139
  const n = [];
140
140
  try {
141
- let i = Z(r), s = 0;
141
+ let i = q(r), s = 0;
142
142
  for (; i && s < t && n.length < e; ) {
143
- const a = Q(i);
144
- a && !ee(a) && te(a) && n.push(a), i = i.return, s++;
143
+ const a = Z(i);
144
+ a && !Q(a) && ee(a) && n.push(a), i = i.return, s++;
145
145
  }
146
146
  } catch (i) {
147
147
  return c("client", "Error walking fiber tree:", i), { path: null, components: [] };
148
148
  }
149
149
  return n.length === 0 ? { path: null, components: [] } : { path: n.slice().reverse().map((i) => `<${i}>`).join(" "), components: n };
150
150
  }
151
- let S = null, E = null;
152
- function N(r, e, t, n = "solid") {
151
+ let O = null;
152
+ function D(r, e, t, n = "solid") {
153
153
  const o = document.createElement("div");
154
- 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;
154
+ 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;
155
155
  }
156
- function oe(r) {
157
- R();
156
+ function ne(r) {
157
+ L();
158
158
  const e = r.getBoundingClientRect();
159
- S = N(e, v.SELECT_OVERLAY_BORDER, v.SELECT_OVERLAY_BG), S.className = "forge-overlay", document.body.appendChild(S);
159
+ O = D(e, v.SELECT_OVERLAY_BORDER, v.SELECT_OVERLAY_BG), O.className = "forge-overlay", document.body.appendChild(O);
160
160
  }
161
- function R() {
162
- S && (S.remove(), S = null);
161
+ function L() {
162
+ O && (O.remove(), O = null);
163
163
  }
164
+ let oe = 0;
164
165
  function ie() {
165
- 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);
166
- }
167
- function se() {
168
- E && (E.remove(), E = null);
166
+ return `ann-${Date.now()}-${++oe}`;
169
167
  }
170
- let re = 0;
171
- function ae() {
172
- return `ann-${Date.now()}-${++re}`;
173
- }
174
- class D {
168
+ class S {
175
169
  active = !1;
176
170
  messenger;
177
171
  hoverOverlay = null;
178
172
  componentTooltip = null;
179
- hitTestOverlay = null;
180
173
  dragRect = null;
181
174
  dragHighlights = [];
182
175
  annotationHighlights = [];
@@ -195,10 +188,10 @@ class D {
195
188
  this.messenger = e, window.__forgeAnnotations = this, window.addEventListener("scroll", this.repositionAll, { capture: !0, passive: !0 }), window.addEventListener("resize", this.repositionAll, { passive: !0 });
196
189
  }
197
190
  activate() {
198
- this.active || (this.active = !0, c("annotation", "Annotation mode activated"), this.createHitTestOverlay(), this.addListeners(), this.setMarkersVisible(!0), document.body.style.cursor = "crosshair");
191
+ this.active || (this.active = !0, c("annotation", "Annotation mode activated"), this.addListeners(), this.setMarkersVisible(!0));
199
192
  }
200
193
  deactivate() {
201
- 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 = "");
194
+ this.active && (this.active = !1, c("annotation", "Annotation mode deactivated"), this.removeHoverOverlay(), this.clearAnnotationHighlights(), this.removeDragRect(), this.removeListeners(), this.setMarkersVisible(!1));
202
195
  }
203
196
  selectDot(e) {
204
197
  const t = this.dots.get(e);
@@ -215,7 +208,7 @@ class D {
215
208
  if (this.accumulationId !== e) {
216
209
  this.accumulationId = e, this.accumulationElements = [], this.clearAnnotationHighlights();
217
210
  for (const n of t) {
218
- const o = { xpath: b(n.xpath), forgeId: n.forgeId, forgeIdIndex: n.forgeIdIndex }, i = this.resolveLocator(o);
211
+ const o = { xpath: I(n.xpath), forgeId: n.forgeId, forgeIdIndex: n.forgeIdIndex }, i = this.resolveLocator(o);
219
212
  i && this.accumulationElements.push(i);
220
213
  }
221
214
  this.refreshAccumulationHighlights(), this.hoverSuppressed = !1, c("annotation", `Entered accumulation mode for ${e} with ${this.accumulationElements.length} elements`);
@@ -243,7 +236,7 @@ class D {
243
236
  const o = document.querySelectorAll(`[data-forge-id="${t}"]`);
244
237
  o.length > 1 && (n = Array.from(o).indexOf(e));
245
238
  }
246
- return { xpath: b(M(e)), forgeId: t, forgeIdIndex: n };
239
+ return { xpath: I(M(e)), forgeId: t, forgeIdIndex: n };
247
240
  }
248
241
  elementToInfo(e) {
249
242
  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 };
@@ -258,11 +251,11 @@ class D {
258
251
  if (!this.accumulationId) return;
259
252
  const e = this.accumulationElements;
260
253
  if (e.length === 0) {
261
- this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: 0, dotY: 0, mode: "single", elements: [], xpaths: [], elementTag: "" }, origin: O });
254
+ this.messenger.send({ type: "ACCUMULATION_UPDATED", annotation: { id: this.accumulationId, dotX: 0, dotY: 0, mode: "single", elements: [], xpaths: [], elementTag: "" }, origin: A });
262
255
  return;
263
256
  }
264
- 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];
265
- 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 });
257
+ 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 - R - 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];
258
+ 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: A });
266
259
  }
267
260
  removeDot(e) {
268
261
  const t = this.dots.get(e);
@@ -274,7 +267,7 @@ class D {
274
267
  restoreDots(e) {
275
268
  this.removeAllDots();
276
269
  for (const t of e) {
277
- const n = t.elements.map((i) => ({ xpath: b(i.xpath), forgeId: i.forgeId, forgeIdIndex: i.forgeIdIndex })), o = this.getAnchorRect(n);
270
+ const n = t.elements.map((i) => ({ xpath: I(i.xpath), forgeId: i.forgeId, forgeIdIndex: i.forgeIdIndex })), o = this.getAnchorRect(n);
278
271
  if (o && t.anchorOffset && o.width > 0 && o.height > 0) {
279
272
  const i = { rx: t.anchorOffset.x, ry: t.anchorOffset.y }, s = o.left + i.rx * o.width, a = o.top + i.ry * o.height;
280
273
  this.createDotAtPosition(s, a, t.mode, t.id, t.order, n, i);
@@ -307,16 +300,10 @@ class D {
307
300
  } else this.annotationHighlights.length > 0 && this.pendingHighlightLocators && (this.clearAnnotationHighlightsRaw(), this.highlightLocators(this.pendingHighlightLocators.locators, this.pendingHighlightLocators.showBounding));
308
301
  this.repositionHoverOverlay();
309
302
  };
310
- createHitTestOverlay() {
311
- 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));
312
- }
313
- removeHitTestOverlay() {
314
- this.hitTestOverlay && (this.hitTestOverlay.remove(), this.hitTestOverlay = null);
315
- }
316
303
  showHoverOverlay(e, t, n) {
317
304
  this.hoverOverlay && (this.hoverOverlay.remove(), this.hoverOverlay = null), this.lastHoveredElement = e;
318
305
  const o = e.getBoundingClientRect(), i = t === v.ANNOTATION_MULTI ? v.ANNOTATION_MULTI_BG : v.ANNOTATION_SINGLE_BG;
319
- 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);
306
+ 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);
320
307
  }
321
308
  removeHoverOverlay() {
322
309
  this.hoverOverlay && (this.hoverOverlay.remove(), this.hoverOverlay = null), this.lastHoveredElement = null, this.removeComponentTooltip();
@@ -361,12 +348,12 @@ class D {
361
348
  if (i) {
362
349
  const s = i.getBoundingClientRect();
363
350
  n.push(s);
364
- const a = N(s, v.ANNOTATION_SINGLE, v.ANNOTATION_SINGLE_BG, "solid");
351
+ const a = D(s, v.ANNOTATION_SINGLE, v.ANNOTATION_SINGLE_BG, "solid");
365
352
  a.className = "forge-annotation-highlight", document.body.appendChild(a), this.annotationHighlights.push(a);
366
353
  }
367
354
  }
368
355
  if (t && n.length > 1) {
369
- 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");
356
+ 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");
370
357
  h.className = "forge-annotation-bounding-rect", document.body.appendChild(h), this.annotationHighlights.push(h);
371
358
  }
372
359
  }
@@ -399,7 +386,7 @@ class D {
399
386
  const a = o.getAttribute("data-component");
400
387
  a && !n.has(a) && (n.add(a), t.push(a)), o = o.parentElement;
401
388
  }
402
- const i = ne(e), s = [...t];
389
+ const i = te(e), s = [...t];
403
390
  if (i.components.length > 0)
404
391
  for (const a of i.components)
405
392
  n.has(a) || (n.add(a), s.push(a));
@@ -411,7 +398,7 @@ class D {
411
398
  const n = this.getComponentPath(e);
412
399
  if (!n) return;
413
400
  const o = document.createElement("div");
414
- 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);
401
+ 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);
415
402
  const i = o.getBoundingClientRect();
416
403
  let s = t.left + t.width / 2 - i.width / 2, a = t.top - i.height - 6;
417
404
  s < 4 && (s = 4), s + i.width > window.innerWidth - 4 && (s = window.innerWidth - i.width - 4), a < 4 && (a = t.bottom + 6), o.style.left = `${s}px`, o.style.top = `${a}px`, this.componentTooltip = o;
@@ -420,7 +407,7 @@ class D {
420
407
  this.componentTooltip && (this.componentTooltip.remove(), this.componentTooltip = null);
421
408
  }
422
409
  showDragRect(e, t, n, o) {
423
- 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` });
410
+ 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` });
424
411
  }
425
412
  removeDragRect() {
426
413
  this.dragRect && (this.dragRect.remove(), this.dragRect = null), this.clearDragHighlights();
@@ -428,7 +415,7 @@ class D {
428
415
  showDragHighlights(e) {
429
416
  this.clearDragHighlights();
430
417
  for (const t of e) {
431
- const n = t.getBoundingClientRect(), o = N(n, v.ANNOTATION_MULTI, v.ANNOTATION_MULTI_BG, "solid");
418
+ const n = t.getBoundingClientRect(), o = D(n, v.ANNOTATION_MULTI, v.ANNOTATION_MULTI_BG, "solid");
432
419
  o.className = "forge-annotation-drag-highlight", document.body.appendChild(o), this.dragHighlights.push(o);
433
420
  }
434
421
  }
@@ -437,12 +424,12 @@ class D {
437
424
  this.dragHighlights = [];
438
425
  }
439
426
  createDot(e, t, n, o, i, s = []) {
440
- 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 };
427
+ const a = this.getAnchorRect(s), l = e - 2, h = t - R - 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 };
441
428
  this.createDotAtPosition(l, h, n, o, i, s, d);
442
429
  }
443
430
  createDotAtPosition(e, t, n, o, i, s, a) {
444
431
  const l = document.createElement("div");
445
- 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", () => {
432
+ Object.assign(l.style, { position: "fixed", left: `${e}px`, top: `${t}px`, minWidth: `${B}px`, height: `${R}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", () => {
446
433
  l.style.transform = "scale(1.05)", this.removeHoverOverlay();
447
434
  }), l.addEventListener("mouseleave", () => {
448
435
  l.style.transform = "scale(1)";
@@ -451,7 +438,7 @@ class D {
451
438
  const d = this.dots.get(o);
452
439
  d && this.highlightAnnotationElements(d);
453
440
  const m = l.getBoundingClientRect();
454
- this.messenger.send({ type: "ANNOTATION_DOT_CLICKED", annotationId: o, dotX: m.left, dotY: m.bottom, origin: O });
441
+ this.messenger.send({ type: "ANNOTATION_DOT_CLICKED", annotationId: o, dotX: m.left, dotY: m.bottom, origin: A });
455
442
  }), document.body.appendChild(l), this.dots.set(o, { id: o, element: l, mode: n, order: i, locators: s, anchorRatio: a });
456
443
  }
457
444
  updateOrders(e) {
@@ -461,9 +448,9 @@ class D {
461
448
  }
462
449
  }
463
450
  elementAtPoint(e, t) {
464
- this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none"), this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "none");
451
+ this.hoverOverlay && (this.hoverOverlay.style.pointerEvents = "none"), this.dots.forEach((o) => o.element.style.pointerEvents = "none");
465
452
  const n = document.elementFromPoint(e, t);
466
- 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);
453
+ 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);
467
454
  }
468
455
  escapeToSvgRoot(e) {
469
456
  if (!(e instanceof SVGElement)) return e;
@@ -496,19 +483,19 @@ class D {
496
483
  }
497
484
  elementsInRect(e, t, n, o) {
498
485
  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();
499
- if (h.forEach((p) => {
500
- const g = p, y = g.getAttribute("data-forge-id");
486
+ if (h.forEach((f) => {
487
+ const g = f, y = g.getAttribute("data-forge-id");
501
488
  if (!y || m.has(y) || g instanceof SVGElement && g.tagName.toLowerCase() !== "svg" || g.closest?.("svg") && g.tagName.toLowerCase() !== "svg") return;
502
- const f = this.findTopmostWithSameForgeId(g);
503
- if (m.has(f.getAttribute("data-forge-id") || "")) return;
504
- const L = f.getBoundingClientRect();
505
- L.right >= i && L.left <= a && L.bottom >= s && L.top <= l && (m.add(y), d.push(f));
489
+ const p = this.findTopmostWithSameForgeId(g);
490
+ if (m.has(p.getAttribute("data-forge-id") || "")) return;
491
+ const N = p.getBoundingClientRect();
492
+ N.right >= i && N.left <= a && N.bottom >= s && N.top <= l && (m.add(y), d.push(p));
506
493
  }), this.dragScopeParent) {
507
- const p = this.findForgeIdParent(this.dragScopeParent);
508
- if (p)
494
+ const f = this.findForgeIdParent(this.dragScopeParent);
495
+ if (f)
509
496
  return d.filter((y) => {
510
- const f = this.findForgeIdParent(y);
511
- return f ? this.findForgeIdParent(f) === p : !1;
497
+ const p = this.findForgeIdParent(y);
498
+ return p ? this.findForgeIdParent(p) === f : !1;
512
499
  });
513
500
  const g = this.dragScopeParent;
514
501
  return d.filter((y) => this.findForgeIdParent(y) === g);
@@ -516,6 +503,7 @@ class D {
516
503
  return d;
517
504
  }
518
505
  handleMouseMove = (e) => {
506
+ if (this.isAnnotationDotEventTarget(e)) return;
519
507
  if (this.hoverSuppressed) {
520
508
  this.removeHoverOverlay();
521
509
  return;
@@ -528,7 +516,7 @@ class D {
528
516
  }
529
517
  if (e.buttons === 1) {
530
518
  const n = e.clientX - this.dragStartX, o = e.clientY - this.dragStartY;
531
- if (Math.abs(n) > D.DRAG_THRESHOLD || Math.abs(o) > D.DRAG_THRESHOLD) {
519
+ if (Math.abs(n) > S.DRAG_THRESHOLD || Math.abs(o) > S.DRAG_THRESHOLD) {
532
520
  this.isDragging = !0;
533
521
  return;
534
522
  }
@@ -542,6 +530,7 @@ class D {
542
530
  };
543
531
  static DRAG_THRESHOLD = 5;
544
532
  handleMouseDown = (e) => {
533
+ if (this.isAnnotationDotEventTarget(e)) return;
545
534
  this.dragStartX = e.clientX, this.dragStartY = e.clientY, this.isDragging = !1;
546
535
  const t = this.elementAtPoint(e.clientX, e.clientY);
547
536
  if (t) {
@@ -552,6 +541,7 @@ class D {
552
541
  e.preventDefault();
553
542
  };
554
543
  handleMouseUp = (e) => {
544
+ if (this.isAnnotationDotEventTarget(e)) return;
555
545
  if (this.isDragging) {
556
546
  this.isDragging = !1;
557
547
  const o = this.elementsInRect(this.dragStartX, this.dragStartY, e.clientX, e.clientY);
@@ -575,8 +565,12 @@ class D {
575
565
  this.createAnnotationFromElements([n], "single", e.clientX, e.clientY);
576
566
  };
577
567
  handleClick = (e) => {
578
- e.preventDefault(), e.stopPropagation();
568
+ this.isAnnotationDotEventTarget(e) || (e.preventDefault(), e.stopPropagation());
579
569
  };
570
+ isAnnotationDotEventTarget(e) {
571
+ const t = e.target;
572
+ return t instanceof Element && t.closest(".forge-annotation-dot") !== null;
573
+ }
580
574
  handleKeyDown = (e) => {
581
575
  if (e.key === "Escape") {
582
576
  if (this.accumulationId) {
@@ -597,39 +591,37 @@ class D {
597
591
  this.pendingAnnotations.delete(e), this.accumulationId === e && (this.accumulationId = null, this.accumulationElements = []), this.clearAnnotationHighlights(), this.hoverSuppressed = !1;
598
592
  }
599
593
  createAnnotationFromElements(e, t, n, o, i) {
600
- const s = i || ae();
594
+ const s = i || ie();
601
595
  this.hoverSuppressed = !0, this.removeHoverOverlay();
602
- 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 };
596
+ 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 - R - 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 };
603
597
  this.pendingAnnotations.set(s, { dotX: n, dotY: o, mode: t, locators: l }), this.clearDragHighlights(), this.highlightLocators(l, t === "multi");
604
- 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 };
605
- c("annotation", "Annotation created (pending):", y), this.messenger.send({ type: "ANNOTATION_CREATED", annotation: y, origin: O });
598
+ 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 };
599
+ c("annotation", "Annotation created (pending):", y), this.messenger.send({ type: "ANNOTATION_CREATED", annotation: y, origin: A });
606
600
  }
607
601
  handleDocumentLeave = () => {
608
602
  this.removeHoverOverlay();
609
603
  };
610
604
  addListeners() {
611
- 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));
605
+ 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);
612
606
  }
613
607
  removeListeners() {
614
- 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);
608
+ 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);
615
609
  }
616
610
  }
617
- class le {
611
+ class se {
618
612
  messenger;
619
613
  callbacks;
620
- hitTestOverlay = null;
621
- hoveredElement = null;
622
614
  constructor(e, t) {
623
615
  this.messenger = e, this.callbacks = t;
624
616
  }
625
617
  enableListeners() {
626
- 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);
618
+ document.addEventListener("mousemove", this.handleMouseOver, !0), document.addEventListener("click", this.handleClick, !0), document.addEventListener("mouseleave", this.handleMouseOut), document.addEventListener("scroll", this.handleScroll, !0);
627
619
  }
628
620
  disableListeners() {
629
- 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;
621
+ 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();
630
622
  }
631
623
  clearHover() {
632
- this.hoveredElement = null, R();
624
+ L();
633
625
  }
634
626
  findTopmostElementWithSameId(e) {
635
627
  const t = e.getAttribute("data-forge-id");
@@ -643,80 +635,89 @@ class le {
643
635
  return o;
644
636
  }
645
637
  handleSelectModeClick(e) {
646
- const t = b(M(e));
647
- 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 });
638
+ const t = I(M(e));
639
+ c("client", "Element clicked, XPath:", t), this.messenger.send({ type: "XPATH_REPORT", xpath: t, origin: A }), this.messenger.send({ type: "SELECT_MODE_DISABLED", origin: A });
648
640
  }
649
641
  handleMouseOver = (e) => {
650
642
  if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode() || this.callbacks.getHoverDisabled()) return;
651
- this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none");
652
- const t = document.elementFromPoint(e.clientX, e.clientY);
653
- if (this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "auto"), t && t !== document.body && t !== document.documentElement) {
643
+ const t = this.resolveTarget(e);
644
+ if (t && t !== document.body && t !== document.documentElement) {
654
645
  const o = t.getAttribute("data-forge-id") ? this.findTopmostElementWithSameId(t) : t;
655
646
  if (this.callbacks.getDesignMode() && o === this.callbacks.getSelectedDesignElement())
656
647
  return;
657
- this.hoveredElement = o, oe(o);
648
+ ne(o);
658
649
  }
659
650
  };
660
651
  handleMouseOut = (e) => {
661
- if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode()) return;
662
- e.target === this.hoveredElement && (this.hoveredElement = null, R());
652
+ !this.callbacks.getSelectMode() && !this.callbacks.getDesignMode() || L();
663
653
  };
664
654
  handleClick = (e) => {
665
655
  if (!this.callbacks.getSelectMode() && !this.callbacks.getDesignMode()) return;
666
- e.preventDefault(), e.stopPropagation(), this.hitTestOverlay && (this.hitTestOverlay.style.pointerEvents = "none");
667
- const t = document.elementFromPoint(e.clientX, e.clientY);
668
- 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)));
656
+ e.preventDefault(), e.stopPropagation();
657
+ const t = this.resolveTarget(e);
658
+ t && t !== document.body && t !== document.documentElement && (this.callbacks.getSelectMode() && this.callbacks.onSelectClick(t), this.callbacks.getDesignMode() && (L(), this.callbacks.onDesignClick(t)));
669
659
  };
660
+ resolveTarget(e) {
661
+ const n = this.resolveElementFromPoint(e.clientX, e.clientY) ?? e.target;
662
+ return !n || !(n instanceof Element) ? null : n instanceof HTMLElement || n instanceof SVGElement ? n : null;
663
+ }
664
+ resolveElementFromPoint(e, t) {
665
+ const n = document.elementsFromPoint(e, t);
666
+ for (const o of n)
667
+ if (!o.classList.contains("forge-overlay"))
668
+ return o;
669
+ return null;
670
+ }
670
671
  handleScroll = () => {
671
- (this.callbacks.getSelectMode() || this.callbacks.getDesignMode()) && (this.hoveredElement = null, R());
672
+ (this.callbacks.getSelectMode() || this.callbacks.getDesignMode()) && L();
672
673
  };
673
674
  }
674
- let w = null, _ = null, P = null;
675
- async function ce() {
676
- if (w && _ && P) return;
675
+ let _ = null, H = null, w = null;
676
+ async function re() {
677
+ if (_ && H && w) return;
677
678
  const [r, e, t] = await Promise.all([import("@babel/parser"), import("@babel/traverse"), import("@babel/generator")]);
678
- w = r.parse;
679
+ _ = r.parse;
679
680
  const n = e.default;
680
- _ = typeof n == "function" ? n : n.default;
681
+ H = typeof n == "function" ? n : n.default;
681
682
  const o = t.default;
682
- P = typeof o == "function" ? o : o.default;
683
+ w = typeof o == "function" ? o : o.default;
683
684
  }
684
- function F(r) {
685
+ function k(r) {
685
686
  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 };
686
687
  }
687
- function $(r, e, t) {
688
+ function F(r, e, t) {
688
689
  const n = r.node.attributes.find((o) => o.type === "JSXAttribute" && o.name.type === "JSXIdentifier" && o.name.name === e);
689
- 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);
690
+ 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);
690
691
  }
691
- async function he(r, e, t, n, o) {
692
+ async function ae(r, e, t, n, o) {
692
693
  try {
693
- if (await ce(), !w || !_ || !P) return r;
694
- const i = w(r, { sourceType: "module", plugins: ["jsx", "typescript"] });
694
+ if (await re(), !_ || !H || !w) return r;
695
+ const i = _(r, { sourceType: "module", plugins: ["jsx", "typescript"] });
695
696
  let s = !1;
696
697
  const a = /* @__PURE__ */ new Map();
697
- if (_(i, { JSXOpeningElement(l) {
698
+ if (H(i, { JSXOpeningElement(l) {
698
699
  if (l.node.name.type !== "JSXIdentifier") return;
699
700
  const h = l.node.loc;
700
701
  if (!h) return;
701
702
  const d = `${h.start.line}:${h.start.column}`;
702
703
  a.set(d, l);
703
- const m = l.node.attributes.find((p) => p.type === "JSXAttribute" && p.name.type === "JSXIdentifier" && p.name.name === "data-forge-id" && p.value?.type === "StringLiteral");
704
- m && m.type === "JSXAttribute" && m.value.value === e && (s = $(l, t, n));
704
+ const m = l.node.attributes.find((f) => f.type === "JSXAttribute" && f.name.type === "JSXIdentifier" && f.name.name === "data-forge-id" && f.value?.type === "StringLiteral");
705
+ m && m.type === "JSXAttribute" && m.value.value === e && (s = F(l, t, n));
705
706
  } }), !s && o) {
706
707
  const l = o.split(":");
707
708
  if (l.length >= 5) {
708
709
  const h = `${l[l.length - 4]}:${l[l.length - 3]}`, d = a.get(h);
709
- d && (s = $(d, t, n));
710
+ d && (s = F(d, t, n));
710
711
  }
711
712
  }
712
713
  if (s)
713
- return P(i, {}, r).code;
714
+ return w(i, {}, r).code;
714
715
  } catch (i) {
715
716
  c("client", "Failed to parse/update AST:", i);
716
717
  }
717
718
  return r;
718
719
  }
719
- async function de(r) {
720
+ async function le(r) {
720
721
  try {
721
722
  const e = await fetch(`/__forge-read-source?path=${r}`);
722
723
  if (e.ok)
@@ -727,14 +728,14 @@ async function de(r) {
727
728
  }
728
729
  return null;
729
730
  }
730
- async function ue(r, e) {
731
+ async function ce(r, e) {
731
732
  try {
732
733
  return await fetch("/__forge-update-source", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ filePath: r, source: e }) }), !0;
733
734
  } catch (t) {
734
735
  return c("client", "Failed to write source:", t), !1;
735
736
  }
736
737
  }
737
- class ge {
738
+ class he {
738
739
  messenger;
739
740
  componentRegistry;
740
741
  selectController;
@@ -757,8 +758,8 @@ class ge {
757
758
  }
758
759
  const n = this.selectController.findTopmostElementWithSameId(e), o = n.getAttribute("data-component"), i = n.getAttribute("data-source-pos"), s = o || n.tagName.toLowerCase();
759
760
  this.clearSelection(), this.selectedElement = n, this.applyHighlight(n);
760
- const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h = b(M(n)), d = this.componentRegistry.getEditableProps(s), m = this.extractPropValues(n, d);
761
- 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 });
761
+ const a = n.textContent?.trim() || "", l = n.tagName.toLowerCase(), h = I(M(n)), d = this.componentRegistry.getEditableProps(s), m = this.extractPropValues(n, d);
762
+ 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: A });
762
763
  }
763
764
  updateText(e, t) {
764
765
  this.updateProperty(e, "children", t);
@@ -781,11 +782,11 @@ class ge {
781
782
  }
782
783
  const a = s.slice(0, -4).join(":");
783
784
  c("client", `Updating property ${t} = ${n} for ${e} in ${a}`), this.sourceCache.delete(a);
784
- const l = await de(a);
785
+ const l = await le(a);
785
786
  if (!l) return;
786
787
  this.sourceCache.set(a, l);
787
- const h = this.selectedElement?.getAttribute("data-source-pos") ?? null, d = await he(l, e, t, n, h);
788
- 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}`);
788
+ const h = this.selectedElement?.getAttribute("data-source-pos") ?? null, d = await ae(l, e, t, n, h);
789
+ 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: A }))) : c("client", `No source changes detected for ${a}`);
789
790
  }
790
791
  applyHighlight(e) {
791
792
  e.style.outline = `3px solid ${v.DESIGN_SELECTION_OUTLINE}`, e.style.outlineOffset = "2px";
@@ -815,7 +816,8 @@ class ge {
815
816
  return t ? e[t] : null;
816
817
  }
817
818
  }
818
- class C {
819
+ class E {
820
+ static ANNOTATION_CURSOR_LOCK_CLASS = "forge-annotation-cursor-lock";
819
821
  static instance = null;
820
822
  messenger;
821
823
  readyIntervalId = null;
@@ -827,25 +829,26 @@ class C {
827
829
  annotationOverlay = null;
828
830
  selectController;
829
831
  designController;
832
+ annotationCursorLockStyleEl = null;
830
833
  onError;
831
834
  constructor(e) {
832
- 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;
835
+ this.onError = e?.onError, c("client", "ForgeClient initialized"), this.messenger = new G(), 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;
833
836
  }
834
837
  static getInstance(e) {
835
- return C.instance || (C.instance = new C(e)), C.instance;
838
+ return E.instance || (E.instance = new E(e)), E.instance;
836
839
  }
837
840
  enableAnnotationMode(e) {
838
841
  this.setAnnotationMode(e);
839
842
  }
840
843
  restoreAnnotations(e) {
841
- this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.annotationOverlay.restoreDots(e);
844
+ this.annotationOverlay || (this.annotationOverlay = new S(this.messenger)), this.annotationOverlay.restoreDots(e);
842
845
  }
843
846
  setupMessageListener() {
844
847
  c("client", "Setting up message listener..."), this.messenger.onMessage((e) => {
845
- if (W(e.data) || !e.data || typeof e.data != "object" || !("origin" in e.data)) return;
848
+ if (W(e.data) || (this.isConnectedToHost || (this.isConnectedToHost = !0, this.readyIntervalId !== null && (window.clearInterval(this.readyIntervalId), this.readyIntervalId = null, c("client", "Host connection detected, stopped CHILD_READY retries"))), console.log("Received message from host:", { isConnectedToHost: this.isConnectedToHost }), !e.data || typeof e.data != "object" || !("origin" in e.data))) return;
846
849
  const t = e.data;
847
- if (t.origin === j) {
848
- 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);
850
+ if (t.origin === V) {
851
+ c("client", "Received message from host:", t);
849
852
  try {
850
853
  switch (t.type) {
851
854
  case "ENABLE_SELECT_MODE":
@@ -891,7 +894,7 @@ class C {
891
894
  this.annotationOverlay?.toggleMarkers();
892
895
  break;
893
896
  case "RESTORE_ANNOTATIONS":
894
- this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.annotationOverlay.restoreDots(t.annotations);
897
+ this.annotationOverlay || (this.annotationOverlay = new S(this.messenger)), this.annotationOverlay.restoreDots(t.annotations);
895
898
  break;
896
899
  case "PING":
897
900
  c("client", "Received PING");
@@ -904,13 +907,26 @@ class C {
904
907
  });
905
908
  }
906
909
  setSelectMode(e) {
907
- this.selectMode !== e && (c("client", `Setting select mode to: ${e}`), this.selectMode = e, e ? (this.selectController.enableListeners(), document.body.style.cursor = "crosshair") : (this.selectController.disableListeners(), document.body.style.cursor = "", this.selectController.clearHover()));
910
+ this.selectMode !== e && (c("client", `Setting select mode to: ${e}`), this.selectMode = e, e ? this.selectController.enableListeners() : (this.selectController.disableListeners(), this.selectController.clearHover()));
908
911
  }
909
912
  setDesignMode(e) {
910
- this.designMode !== e && (c("client", `Setting design mode to: ${e}`), this.designMode = e, e ? (this.selectController.enableListeners(), this.hoverDisabled = !1, document.body.style.cursor = "crosshair") : (this.selectController.disableListeners(), this.hoverDisabled = !1, document.body.style.cursor = "", this.selectController.clearHover()));
913
+ this.designMode !== e && (c("client", `Setting design mode to: ${e}`), this.designMode = e, e ? (this.selectController.enableListeners(), this.hoverDisabled = !1) : (this.selectController.disableListeners(), this.hoverDisabled = !1, this.selectController.clearHover()));
911
914
  }
912
915
  setAnnotationMode(e) {
913
- e ? (this.annotationOverlay || (this.annotationOverlay = new D(this.messenger)), this.setSelectMode(!1), this.setDesignMode(!1), this.annotationOverlay.activate()) : this.annotationOverlay?.deactivate();
916
+ e ? (this.enableAnnotationCursorLock(), this.annotationOverlay || (this.annotationOverlay = new S(this.messenger)), this.setSelectMode(!1), this.setDesignMode(!1), this.annotationOverlay.activate()) : (this.annotationOverlay?.deactivate(), this.disableAnnotationCursorLock());
917
+ }
918
+ enableAnnotationCursorLock() {
919
+ if (document.documentElement.classList.add(E.ANNOTATION_CURSOR_LOCK_CLASS), this.annotationCursorLockStyleEl) return;
920
+ const e = document.createElement("style");
921
+ e.id = "forge-annotation-cursor-lock-style", e.textContent = `
922
+ html.${E.ANNOTATION_CURSOR_LOCK_CLASS},
923
+ html.${E.ANNOTATION_CURSOR_LOCK_CLASS} * {
924
+ cursor: crosshair !important;
925
+ }
926
+ `, (document.head ?? document.documentElement).appendChild(e), this.annotationCursorLockStyleEl = e;
927
+ }
928
+ disableAnnotationCursorLock() {
929
+ document.documentElement.classList.remove(E.ANNOTATION_CURSOR_LOCK_CLASS), this.annotationCursorLockStyleEl && (this.annotationCursorLockStyleEl.remove(), this.annotationCursorLockStyleEl = null);
914
930
  }
915
931
  handleSelectClick(e) {
916
932
  this.selectController.handleSelectModeClick(e), this.setSelectMode(!1);
@@ -920,14 +936,14 @@ class C {
920
936
  }
921
937
  sendReady() {
922
938
  c("client", "Scheduling CHILD_READY message..."), setTimeout(() => {
923
- 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(() => {
939
+ this.isConnectedToHost || (c("client", "Sending CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: A }), this.readyIntervalId === null && (this.readyIntervalId = window.setInterval(() => {
924
940
  if (this.isConnectedToHost) {
925
941
  this.readyIntervalId !== null && (window.clearInterval(this.readyIntervalId), this.readyIntervalId = null);
926
942
  return;
927
943
  }
928
- c("client", "Retrying CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: O });
929
- }, k.CHILD_READY_RETRY_INTERVAL)));
930
- }, k.CHILD_READY_DELAY);
944
+ c("client", "Retrying CHILD_READY message to parent"), this.messenger.send({ type: "CHILD_READY", origin: A });
945
+ }, P.CHILD_READY_RETRY_INTERVAL)));
946
+ }, P.CHILD_READY_DELAY);
931
947
  }
932
948
  setupForgeIdPropagation() {
933
949
  const e = () => {
@@ -956,8 +972,8 @@ class C {
956
972
  }
957
973
  }
958
974
  }
959
- C.getInstance();
975
+ E.getInstance();
960
976
  export {
961
- C as ForgeClient,
962
- V as ParentMessenger
977
+ E as ForgeClient,
978
+ G as ParentMessenger
963
979
  };
@@ -36,20 +36,20 @@ class a {
36
36
  };
37
37
  }
38
38
  }
39
- 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;
39
+ 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;
40
40
  export {
41
41
  A as B,
42
42
  _ as C,
43
- T as M,
43
+ O as M,
44
44
  a as P,
45
- I as R,
45
+ c as R,
46
46
  i as T,
47
47
  E as W,
48
- O as Z,
48
+ T as Z,
49
49
  r as a,
50
- L as b,
50
+ D as b,
51
51
  d as c,
52
- c as d,
52
+ I as d,
53
53
  N as e,
54
54
  o as i
55
55
  };
@@ -0,0 +1,13 @@
1
+ let n = !1;
2
+ function i(e = !0) {
3
+ n = e;
4
+ }
5
+ function l(e, ...t) {
6
+ if (!n) return;
7
+ const o = e === "client" ? "🔵" : e === "host" ? "🟡" : e === "annotation" ? "🟢" : "⚪", s = (/* @__PURE__ */ new Date()).toISOString().split("T")[1].slice(0, -1);
8
+ console.log(`[${s}] ${o} [${e.toUpperCase()}]`, ...t);
9
+ }
10
+ export {
11
+ l as d,
12
+ i as e
13
+ };
package/dist/host.js CHANGED
@@ -1,5 +1,5 @@
1
- import { T as c, W as h, a as i, i as d, M as E } from "./constants-DqGvo09s.js";
2
- import { d as n } from "./debug-CLzmqn3R.js";
1
+ import { T as c, W as h, a as i, i as d, M as E } from "./constants-DHvpLY46.js";
2
+ import { d as n } from "./debug-BuKzUOMn.js";
3
3
  class u {
4
4
  iframe;
5
5
  messenger = null;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ForgeHost as r } from "./host.js";
2
2
  import { ForgeClient as t } from "./client.js";
3
- import { a as S, u as m } from "./useDesignMode-VIipNUSj.js";
4
- import { e as p } from "./debug-CLzmqn3R.js";
5
- import { a as E, M as g } from "./constants-DqGvo09s.js";
3
+ import { a as S, u as m } from "./useDesignMode--DcwfmhZ.js";
4
+ import { e as p } from "./debug-BuKzUOMn.js";
5
+ import { a as E, M as g } from "./constants-DHvpLY46.js";
6
6
  export {
7
7
  t as ForgeClient,
8
8
  r as ForgeHost,
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as o, u as a } from "./useDesignMode-VIipNUSj.js";
1
+ import { a as o, u as a } from "./useDesignMode--DcwfmhZ.js";
2
2
  export {
3
3
  o as useDesignMode,
4
4
  a as useElementSelector
@@ -1,5 +1,5 @@
1
1
  import { useState as r, useEffect as S, useCallback as s } from "react";
2
- import { d as i } from "./debug-CLzmqn3R.js";
2
+ import { d as i } from "./debug-BuKzUOMn.js";
3
3
  function E(e) {
4
4
  const [d, u] = r(!1), [a, l] = r(""), [b, o] = r("disconnected");
5
5
  S(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernovaio/prototyping-tooling",
3
- "version": "0.9.7-alpha.0",
3
+ "version": "0.9.7-alpha.2",
4
4
  "description": "Prototyping Tooling — iframe communication bridge for design-to-code workflows",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,11 +0,0 @@
1
- let t = !1;
2
- function a(e = !0) {
3
- t = e;
4
- }
5
- function g(e, ...n) {
6
- t && (/* @__PURE__ */ new Date()).toISOString().split("T")[1].slice(0, -1);
7
- }
8
- export {
9
- g as d,
10
- a as e
11
- };