@base44-preview/vite-plugin 0.2.22-pr.36.db00ef7 → 0.2.22-pr.37.26664a5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/injections/utils.d.ts +0 -6
  2. package/dist/injections/utils.d.ts.map +1 -1
  3. package/dist/injections/utils.js +0 -25
  4. package/dist/injections/utils.js.map +1 -1
  5. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts +25 -0
  6. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts.map +1 -0
  7. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js +95 -0
  8. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js.map +1 -0
  9. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts +4 -0
  10. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts.map +1 -0
  11. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js +4 -0
  12. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js.map +1 -0
  13. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts +9 -0
  14. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts.map +1 -0
  15. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js +26 -0
  16. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js.map +1 -0
  17. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts +10 -0
  18. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts.map +1 -0
  19. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js +60 -0
  20. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js.map +1 -0
  21. package/dist/injections/visual-edit-agent/constants.d.ts +10 -0
  22. package/dist/injections/visual-edit-agent/constants.d.ts.map +1 -0
  23. package/dist/injections/visual-edit-agent/constants.js +10 -0
  24. package/dist/injections/visual-edit-agent/constants.js.map +1 -0
  25. package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts +10 -0
  26. package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts.map +1 -0
  27. package/dist/injections/visual-edit-agent/handlers/click-handlers.js +107 -0
  28. package/dist/injections/visual-edit-agent/handlers/click-handlers.js.map +1 -0
  29. package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts +14 -0
  30. package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts.map +1 -0
  31. package/dist/injections/visual-edit-agent/handlers/hover-handlers.js +64 -0
  32. package/dist/injections/visual-edit-agent/handlers/hover-handlers.js.map +1 -0
  33. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts +14 -0
  34. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts.map +1 -0
  35. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js +109 -0
  36. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js.map +1 -0
  37. package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts +26 -0
  38. package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts.map +1 -0
  39. package/dist/injections/visual-edit-agent/handlers/message-handlers.js +145 -0
  40. package/dist/injections/visual-edit-agent/handlers/message-handlers.js.map +1 -0
  41. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts +7 -0
  42. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts.map +1 -0
  43. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js +58 -0
  44. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js.map +1 -0
  45. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts +11 -0
  46. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts.map +1 -0
  47. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js +32 -0
  48. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js.map +1 -0
  49. package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts +86 -0
  50. package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts.map +1 -0
  51. package/dist/injections/visual-edit-agent/handlers/messages/types.js +28 -0
  52. package/dist/injections/visual-edit-agent/handlers/messages/types.js.map +1 -0
  53. package/dist/injections/visual-edit-agent/index.d.ts +5 -0
  54. package/dist/injections/visual-edit-agent/index.d.ts.map +1 -0
  55. package/dist/injections/visual-edit-agent/index.js +106 -0
  56. package/dist/injections/visual-edit-agent/index.js.map +1 -0
  57. package/dist/injections/visual-edit-agent/state/agent-state.d.ts +17 -0
  58. package/dist/injections/visual-edit-agent/state/agent-state.d.ts.map +1 -0
  59. package/dist/injections/visual-edit-agent/state/agent-state.js +18 -0
  60. package/dist/injections/visual-edit-agent/state/agent-state.js.map +1 -0
  61. package/dist/injections/visual-edit-agent/ui/overlay.d.ts +26 -0
  62. package/dist/injections/visual-edit-agent/ui/overlay.d.ts.map +1 -0
  63. package/dist/injections/visual-edit-agent/ui/overlay.js +102 -0
  64. package/dist/injections/visual-edit-agent/ui/overlay.js.map +1 -0
  65. package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts +14 -0
  66. package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts.map +1 -0
  67. package/dist/injections/visual-edit-agent/utils/dom-utils.js +34 -0
  68. package/dist/injections/visual-edit-agent/utils/dom-utils.js.map +1 -0
  69. package/dist/injections/visual-edit-agent.d.ts +1 -1
  70. package/dist/injections/visual-edit-agent.d.ts.map +1 -1
  71. package/dist/injections/visual-edit-agent.js +1 -474
  72. package/dist/injections/visual-edit-agent.js.map +1 -1
  73. package/dist/statics/index.mjs +5 -1
  74. package/dist/statics/index.mjs.map +1 -1
  75. package/package.json +1 -1
  76. package/src/injections/utils.ts +0 -34
  77. package/src/injections/visual-edit-agent/README.md +222 -0
  78. package/src/injections/visual-edit-agent/capabilities/inline-editing/core.ts +120 -0
  79. package/src/injections/visual-edit-agent/capabilities/inline-editing/index.ts +10 -0
  80. package/src/injections/visual-edit-agent/capabilities/inline-editing/styles.ts +26 -0
  81. package/src/injections/visual-edit-agent/capabilities/inline-editing/validation.ts +67 -0
  82. package/src/injections/visual-edit-agent/constants.ts +9 -0
  83. package/src/injections/visual-edit-agent/handlers/click-handlers.ts +134 -0
  84. package/src/injections/visual-edit-agent/handlers/hover-handlers.ts +78 -0
  85. package/src/injections/visual-edit-agent/handlers/inline-edit-handlers.ts +141 -0
  86. package/src/injections/visual-edit-agent/handlers/message-handlers.ts +191 -0
  87. package/src/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.ts +70 -0
  88. package/src/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.ts +40 -0
  89. package/src/injections/visual-edit-agent/handlers/messages/types.ts +112 -0
  90. package/src/injections/visual-edit-agent/index.ts +120 -0
  91. package/src/injections/visual-edit-agent/state/agent-state.ts +31 -0
  92. package/src/injections/visual-edit-agent/ui/overlay.ts +123 -0
  93. package/src/injections/visual-edit-agent/utils/dom-utils.ts +39 -0
  94. package/src/injections/visual-edit-agent.ts +1 -577
  95. package/dist/injections/layer-dropdown/consts.d.ts +0 -15
  96. package/dist/injections/layer-dropdown/consts.d.ts.map +0 -1
  97. package/dist/injections/layer-dropdown/consts.js +0 -36
  98. package/dist/injections/layer-dropdown/consts.js.map +0 -1
  99. package/dist/injections/layer-dropdown/controller.d.ts +0 -4
  100. package/dist/injections/layer-dropdown/controller.d.ts.map +0 -1
  101. package/dist/injections/layer-dropdown/controller.js +0 -85
  102. package/dist/injections/layer-dropdown/controller.js.map +0 -1
  103. package/dist/injections/layer-dropdown/dropdown-ui.d.ts +0 -13
  104. package/dist/injections/layer-dropdown/dropdown-ui.d.ts.map +0 -1
  105. package/dist/injections/layer-dropdown/dropdown-ui.js +0 -158
  106. package/dist/injections/layer-dropdown/dropdown-ui.js.map +0 -1
  107. package/dist/injections/layer-dropdown/types.d.ts +0 -21
  108. package/dist/injections/layer-dropdown/types.d.ts.map +0 -1
  109. package/dist/injections/layer-dropdown/types.js +0 -3
  110. package/dist/injections/layer-dropdown/types.js.map +0 -1
  111. package/dist/injections/layer-dropdown/utils.d.ts +0 -23
  112. package/dist/injections/layer-dropdown/utils.d.ts.map +0 -1
  113. package/dist/injections/layer-dropdown/utils.js +0 -119
  114. package/dist/injections/layer-dropdown/utils.js.map +0 -1
  115. package/src/injections/layer-dropdown/consts.ts +0 -44
  116. package/src/injections/layer-dropdown/controller.ts +0 -105
  117. package/src/injections/layer-dropdown/dropdown-ui.ts +0 -221
  118. package/src/injections/layer-dropdown/types.ts +0 -24
  119. package/src/injections/layer-dropdown/utils.ts +0 -148
@@ -0,0 +1,106 @@
1
+ import { createAgentState } from "./state/agent-state.js";
2
+ import { handleMouseOver, handleMouseOut } from "./handlers/hover-handlers.js";
3
+ import { handleElementClick } from "./handlers/click-handlers.js";
4
+ import { handleMessage, handleScroll, handleResize } from "./handlers/message-handlers.js";
5
+ import { setupInlineEditCallback } from "./handlers/inline-edit-handlers.js";
6
+ import { OutgoingMessageType } from "./handlers/messages/types.js";
7
+ /**
8
+ * Initialize element IDs for elements with line numbers
9
+ */
10
+ function initializeElementIds() {
11
+ const elementsWithLineNumber = document.querySelectorAll("[data-linenumber]:not([data-visual-selector-id])");
12
+ elementsWithLineNumber.forEach((el, index) => {
13
+ const htmlEl = el;
14
+ const id = `visual-id-${htmlEl.dataset.filename}-${htmlEl.dataset.linenumber}-${index}`;
15
+ htmlEl.dataset.visualSelectorId = id;
16
+ });
17
+ }
18
+ /**
19
+ * Create mutation observer to detect layout changes.
20
+ * Uses requestAnimationFrame to coalesce many rapid mutations into one reposition
21
+ * per paint frame, avoiding stacking multiple timers during CSS transitions.
22
+ */
23
+ function createLayoutObserver(onLayoutChange) {
24
+ let rafHandle = null;
25
+ const hasVisualId = (node) => {
26
+ if (node.nodeType !== Node.ELEMENT_NODE)
27
+ return false;
28
+ const el = node;
29
+ if (el.dataset?.visualSelectorId)
30
+ return true;
31
+ for (const child of Array.from(el.children)) {
32
+ if (hasVisualId(child))
33
+ return true;
34
+ }
35
+ return false;
36
+ };
37
+ return new MutationObserver((mutations) => {
38
+ if (rafHandle !== null)
39
+ return;
40
+ const needsUpdate = mutations.some((mutation) => {
41
+ const isLayoutChange = mutation.type === "attributes" &&
42
+ (mutation.attributeName === "style" ||
43
+ mutation.attributeName === "class" ||
44
+ mutation.attributeName === "width" ||
45
+ mutation.attributeName === "height");
46
+ return isLayoutChange && hasVisualId(mutation.target);
47
+ });
48
+ if (needsUpdate) {
49
+ rafHandle = requestAnimationFrame(() => {
50
+ rafHandle = null;
51
+ onLayoutChange();
52
+ });
53
+ }
54
+ });
55
+ }
56
+ /**
57
+ * Setup keyboard event protection
58
+ */
59
+ function setupKeyboardProtection() {
60
+ document.addEventListener("keydown", (e) => {
61
+ if (e.target instanceof HTMLElement && e.target.contentEditable === "true") {
62
+ // Don't report keyboard events during inline editing
63
+ return;
64
+ }
65
+ // Forward other keyboard events to parent if needed
66
+ }, true);
67
+ }
68
+ /**
69
+ * Setup event listeners
70
+ */
71
+ function setupEventListeners(state) {
72
+ // Message handling
73
+ window.addEventListener("message", (e) => handleMessage(state, e));
74
+ // Scroll handling
75
+ window.addEventListener("scroll", () => handleScroll(state), true);
76
+ document.addEventListener("scroll", () => handleScroll(state), true);
77
+ // Resize handling
78
+ window.addEventListener("resize", () => handleResize(state));
79
+ window.addEventListener("scroll", () => handleResize(state));
80
+ // Click handling
81
+ document.addEventListener("click", (e) => handleElementClick(state, e), true);
82
+ // Hover handling
83
+ document.addEventListener("mouseover", (e) => handleMouseOver(state, e));
84
+ document.addEventListener("mouseout", () => handleMouseOut(state));
85
+ }
86
+ /**
87
+ * Main setup function for visual edit agent
88
+ */
89
+ export function setupVisualEditAgent() {
90
+ const state = createAgentState();
91
+ initializeElementIds();
92
+ setupInlineEditCallback(state);
93
+ setupKeyboardProtection();
94
+ setupEventListeners(state);
95
+ // Create and start mutation observer
96
+ const mutationObserver = createLayoutObserver(() => handleResize(state));
97
+ mutationObserver.observe(document.body, {
98
+ attributes: true,
99
+ childList: true,
100
+ subtree: true,
101
+ attributeFilter: ["style", "class", "width", "height"],
102
+ });
103
+ // Send ready message to parent
104
+ window.parent.postMessage({ type: OutgoingMessageType.VISUAL_EDIT_AGENT_READY }, "*");
105
+ }
106
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/injections/visual-edit-agent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,SAAS,oBAAoB;IAC3B,MAAM,sBAAsB,GAAG,QAAQ,CAAC,gBAAgB,CACtD,kDAAkD,CACnD,CAAC;IACF,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,EAAiB,CAAC;QACjC,MAAM,EAAE,GAAG,aAAa,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,KAAK,EAAE,CAAC;QACxF,MAAM,CAAC,OAAO,CAAC,gBAAgB,GAAG,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,cAA0B;IACtD,IAAI,SAAS,GAAkB,IAAI,CAAC;IAEpC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CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;IACjC,oBAAoB,EAAE,CAAC;IACvB,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC/B,uBAAuB,EAAE,CAAC;IAC1B,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAE3B,qCAAqC;IACrC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACzE,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE;QACtC,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC;KACvD,CAAC,CAAC;IAEH,+BAA+B;IAC/B,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,mBAAmB,CAAC,uBAAuB,EAAE,EAAE,GAAG,CAAC,CAAC;AACxF,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Central state management for the visual edit agent
3
+ */
4
+ export interface AgentState {
5
+ isVisualEditMode: boolean;
6
+ isPopoverDragging: boolean;
7
+ isDropdownOpen: boolean;
8
+ hoverOverlays: HTMLDivElement[];
9
+ selectedOverlays: HTMLDivElement[];
10
+ currentHighlightedElements: Element[];
11
+ selectedElementId: string | null;
12
+ currentEditingElement: HTMLElement | null;
13
+ debouncedSendTimeout: ReturnType<typeof setTimeout> | null;
14
+ isInlineEditExperimentEnabled: boolean;
15
+ }
16
+ export declare function createAgentState(): AgentState;
17
+ //# sourceMappingURL=agent-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-state.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/state/agent-state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,UAAU;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,0BAA0B,EAAE,OAAO,EAAE,CAAC;IACtC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,qBAAqB,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1C,oBAAoB,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC;IAC3D,6BAA6B,EAAE,OAAO,CAAC;CACxC;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAa7C"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Central state management for the visual edit agent
3
+ */
4
+ export function createAgentState() {
5
+ return {
6
+ isVisualEditMode: false,
7
+ isPopoverDragging: false,
8
+ isDropdownOpen: false,
9
+ hoverOverlays: [],
10
+ selectedOverlays: [],
11
+ currentHighlightedElements: [],
12
+ selectedElementId: null,
13
+ currentEditingElement: null,
14
+ debouncedSendTimeout: null,
15
+ isInlineEditExperimentEnabled: false,
16
+ };
17
+ }
18
+ //# sourceMappingURL=agent-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-state.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/state/agent-state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,gBAAgB,EAAE,KAAK;QACvB,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,aAAa,EAAE,EAAE;QACjB,gBAAgB,EAAE,EAAE;QACpB,0BAA0B,EAAE,EAAE;QAC9B,iBAAiB,EAAE,IAAI;QACvB,qBAAqB,EAAE,IAAI;QAC3B,oBAAoB,EAAE,IAAI;QAC1B,6BAA6B,EAAE,KAAK;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { AgentState } from "../state/agent-state.js";
2
+ /**
3
+ * Create an overlay element for highlighting
4
+ */
5
+ export declare function createOverlay(isSelected?: boolean): HTMLDivElement;
6
+ /**
7
+ * Position overlay relative to element
8
+ */
9
+ export declare function positionOverlay(overlay: HTMLDivElement, element: Element, isSelected?: boolean, isVisualEditMode?: boolean): void;
10
+ /**
11
+ * Clear all overlays from DOM
12
+ */
13
+ export declare function clearOverlays(overlays: HTMLDivElement[]): void;
14
+ /**
15
+ * Remove data-selected attribute, clear selected overlays, and reset selection state
16
+ */
17
+ export declare function clearSelection(state: AgentState): void;
18
+ /**
19
+ * Reposition selected overlays to match current element bounds
20
+ */
21
+ export declare function repositionSelectedOverlays(state: AgentState): void;
22
+ /**
23
+ * Reposition hover overlays to match current element bounds
24
+ */
25
+ export declare function repositionHoverOverlays(state: AgentState): void;
26
+ //# sourceMappingURL=overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/ui/overlay.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,UAAQ,GAAG,cAAc,CAehE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,OAAO,EAChB,UAAU,UAAQ,EAClB,gBAAgB,UAAO,GACtB,IAAI,CA4BN;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAM9D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAYtD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CASlE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAO/D"}
@@ -0,0 +1,102 @@
1
+ import { OVERLAY_TRANSITION, OVERLAY_Z_INDEX, SELECTED_BORDER_COLOR, HOVER_BORDER_COLOR, HOVER_BACKGROUND_COLOR, LABEL_TOP_OFFSET, LABEL_LEFT_OFFSET, } from "../constants.js";
2
+ import { findElementsById } from "../../utils.js";
3
+ /**
4
+ * Create an overlay element for highlighting
5
+ */
6
+ export function createOverlay(isSelected = false) {
7
+ const overlay = document.createElement("div");
8
+ overlay.style.position = "absolute";
9
+ overlay.style.pointerEvents = "none";
10
+ overlay.style.transition = OVERLAY_TRANSITION;
11
+ overlay.style.zIndex = OVERLAY_Z_INDEX;
12
+ if (isSelected) {
13
+ overlay.style.border = `2px solid ${SELECTED_BORDER_COLOR}`;
14
+ }
15
+ else {
16
+ overlay.style.border = `2px solid ${HOVER_BORDER_COLOR}`;
17
+ overlay.style.backgroundColor = HOVER_BACKGROUND_COLOR;
18
+ }
19
+ return overlay;
20
+ }
21
+ /**
22
+ * Position overlay relative to element
23
+ */
24
+ export function positionOverlay(overlay, element, isSelected = false, isVisualEditMode = true) {
25
+ if (!element || !isVisualEditMode)
26
+ return;
27
+ const rect = element.getBoundingClientRect();
28
+ overlay.style.top = `${rect.top + window.scrollY}px`;
29
+ overlay.style.left = `${rect.left + window.scrollX}px`;
30
+ overlay.style.width = `${rect.width}px`;
31
+ overlay.style.height = `${rect.height}px`;
32
+ // Check if label already exists in overlay
33
+ let label = overlay.querySelector("div");
34
+ if (!label) {
35
+ label = document.createElement("div");
36
+ label.textContent = element.tagName.toLowerCase();
37
+ label.style.position = "absolute";
38
+ label.style.top = LABEL_TOP_OFFSET;
39
+ label.style.left = LABEL_LEFT_OFFSET;
40
+ label.style.padding = "2px 8px";
41
+ label.style.fontSize = "11px";
42
+ label.style.fontWeight = isSelected ? "500" : "400";
43
+ label.style.color = isSelected ? "#ffffff" : "#526cff";
44
+ label.style.backgroundColor = isSelected ? "#526cff" : "#DBEAFE";
45
+ label.style.borderRadius = "3px";
46
+ label.style.minWidth = "24px";
47
+ label.style.textAlign = "center";
48
+ overlay.appendChild(label);
49
+ }
50
+ }
51
+ /**
52
+ * Clear all overlays from DOM
53
+ */
54
+ export function clearOverlays(overlays) {
55
+ overlays.forEach((overlay) => {
56
+ if (overlay && overlay.parentNode) {
57
+ overlay.remove();
58
+ }
59
+ });
60
+ }
61
+ /**
62
+ * Remove data-selected attribute, clear selected overlays, and reset selection state
63
+ */
64
+ export function clearSelection(state) {
65
+ if (state.selectedElementId) {
66
+ const elements = findElementsById(state.selectedElementId);
67
+ elements.forEach((el) => {
68
+ if (el instanceof HTMLElement) {
69
+ delete el.dataset.selected;
70
+ }
71
+ });
72
+ }
73
+ clearOverlays(state.selectedOverlays);
74
+ state.selectedOverlays = [];
75
+ state.selectedElementId = null;
76
+ }
77
+ /**
78
+ * Reposition selected overlays to match current element bounds
79
+ */
80
+ export function repositionSelectedOverlays(state) {
81
+ if (!state.selectedElementId)
82
+ return;
83
+ const elements = findElementsById(state.selectedElementId);
84
+ state.selectedOverlays.forEach((overlay, index) => {
85
+ const element = elements[index];
86
+ if (element) {
87
+ positionOverlay(overlay, element, true, state.isVisualEditMode);
88
+ }
89
+ });
90
+ }
91
+ /**
92
+ * Reposition hover overlays to match current element bounds
93
+ */
94
+ export function repositionHoverOverlays(state) {
95
+ state.hoverOverlays.forEach((overlay, index) => {
96
+ const element = state.currentHighlightedElements[index];
97
+ if (element) {
98
+ positionOverlay(overlay, element, false, state.isVisualEditMode);
99
+ }
100
+ });
101
+ }
102
+ //# sourceMappingURL=overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/ui/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,iBAAiB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C,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,OAAO,EAAE,CAAC;YACZ,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ElementPosition } from "../handlers/messages/types.js";
2
+ /**
3
+ * Calculate element position from bounding rect
4
+ */
5
+ export declare function getElementPosition(rect: DOMRect): ElementPosition;
6
+ /**
7
+ * Check if element rect is in viewport
8
+ */
9
+ export declare function isElementInViewport(rect: DOMRect): boolean;
10
+ /**
11
+ * Get element classes (handles both HTML and SVG)
12
+ */
13
+ export declare function getElementClasses(element: Element): string;
14
+ //# sourceMappingURL=dom-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/utils/dom-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAWjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAO1D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAK1D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Calculate element position from bounding rect
3
+ */
4
+ export function getElementPosition(rect) {
5
+ return {
6
+ top: rect.top,
7
+ left: rect.left,
8
+ right: rect.right,
9
+ bottom: rect.bottom,
10
+ width: rect.width,
11
+ height: rect.height,
12
+ centerX: rect.left + rect.width / 2,
13
+ centerY: rect.top + rect.height / 2,
14
+ };
15
+ }
16
+ /**
17
+ * Check if element rect is in viewport
18
+ */
19
+ export function isElementInViewport(rect) {
20
+ return (rect.top < window.innerHeight &&
21
+ rect.bottom > 0 &&
22
+ rect.left < window.innerWidth &&
23
+ rect.right > 0);
24
+ }
25
+ /**
26
+ * Get element classes (handles both HTML and SVG)
27
+ */
28
+ export function getElementClasses(element) {
29
+ if (element instanceof SVGElement) {
30
+ return element.className?.baseVal || "";
31
+ }
32
+ return element.className || "";
33
+ }
34
+ //# sourceMappingURL=dom-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/utils/dom-utils.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC9C,OAAO;QACL,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC;QACnC,OAAO,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC;KACpC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa;IAC/C,OAAO,CACL,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,WAAW;QAC7B,IAAI,CAAC,MAAM,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,UAAU;QAC7B,IAAI,CAAC,KAAK,GAAG,CAAC,CACf,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,IAAI,OAAO,YAAY,UAAU,EAAE,CAAC;QAClC,OAAQ,OAAO,CAAC,SAA0C,EAAE,OAAO,IAAI,EAAE,CAAC;IAC5E,CAAC;IACD,OAAO,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare function setupVisualEditAgent(): void;
1
+ export { setupVisualEditAgent } from "./visual-edit-agent/index.js";
2
2
  //# sourceMappingURL=visual-edit-agent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"visual-edit-agent.d.ts","sourceRoot":"","sources":["../../src/injections/visual-edit-agent.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,SA4jBnC"}
1
+ {"version":3,"file":"visual-edit-agent.d.ts","sourceRoot":"","sources":["../../src/injections/visual-edit-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC"}