@base44-preview/vite-plugin 0.2.26-pr.43.b670203 → 0.2.27-pr.41.77be9cb

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 (168) hide show
  1. package/dist/capabilities/inline-edit/controller.d.ts +3 -0
  2. package/dist/capabilities/inline-edit/controller.d.ts.map +1 -0
  3. package/dist/capabilities/inline-edit/controller.js +194 -0
  4. package/dist/capabilities/inline-edit/controller.js.map +1 -0
  5. package/dist/capabilities/inline-edit/dom-utils.d.ts +6 -0
  6. package/dist/capabilities/inline-edit/dom-utils.d.ts.map +1 -0
  7. package/dist/capabilities/inline-edit/dom-utils.js +49 -0
  8. package/dist/capabilities/inline-edit/dom-utils.js.map +1 -0
  9. package/dist/capabilities/inline-edit/index.d.ts +3 -0
  10. package/dist/capabilities/inline-edit/index.d.ts.map +1 -0
  11. package/dist/capabilities/inline-edit/index.js +2 -0
  12. package/dist/capabilities/inline-edit/index.js.map +1 -0
  13. package/dist/capabilities/inline-edit/types.d.ts +25 -0
  14. package/dist/capabilities/inline-edit/types.d.ts.map +1 -0
  15. package/dist/capabilities/inline-edit/types.js.map +1 -0
  16. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts +25 -0
  17. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts.map +1 -0
  18. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js +95 -0
  19. package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js.map +1 -0
  20. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts +4 -0
  21. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts.map +1 -0
  22. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js +4 -0
  23. package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js.map +1 -0
  24. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts +9 -0
  25. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts.map +1 -0
  26. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js +26 -0
  27. package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js.map +1 -0
  28. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts +17 -0
  29. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts.map +1 -0
  30. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js +76 -0
  31. package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js.map +1 -0
  32. package/dist/injections/visual-edit-agent/constants.d.ts +10 -0
  33. package/dist/injections/visual-edit-agent/constants.d.ts.map +1 -0
  34. package/dist/injections/visual-edit-agent/constants.js +10 -0
  35. package/dist/injections/visual-edit-agent/constants.js.map +1 -0
  36. package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts +10 -0
  37. package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts.map +1 -0
  38. package/dist/injections/visual-edit-agent/handlers/click-handlers.js +117 -0
  39. package/dist/injections/visual-edit-agent/handlers/click-handlers.js.map +1 -0
  40. package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts +14 -0
  41. package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts.map +1 -0
  42. package/dist/injections/visual-edit-agent/handlers/hover-handlers.js +64 -0
  43. package/dist/injections/visual-edit-agent/handlers/hover-handlers.js.map +1 -0
  44. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts +14 -0
  45. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts.map +1 -0
  46. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js +114 -0
  47. package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js.map +1 -0
  48. package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts +26 -0
  49. package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts.map +1 -0
  50. package/dist/injections/visual-edit-agent/handlers/message-handlers.js +148 -0
  51. package/dist/injections/visual-edit-agent/handlers/message-handlers.js.map +1 -0
  52. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts +7 -0
  53. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts.map +1 -0
  54. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js +54 -0
  55. package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js.map +1 -0
  56. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts +11 -0
  57. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts.map +1 -0
  58. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js +32 -0
  59. package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js.map +1 -0
  60. package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts +105 -0
  61. package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts.map +1 -0
  62. package/dist/injections/visual-edit-agent/handlers/messages/types.js +28 -0
  63. package/dist/injections/visual-edit-agent/handlers/messages/types.js.map +1 -0
  64. package/dist/injections/visual-edit-agent/index.d.ts +6 -0
  65. package/dist/injections/visual-edit-agent/index.d.ts.map +1 -0
  66. package/dist/injections/visual-edit-agent/index.js +109 -0
  67. package/dist/injections/visual-edit-agent/index.js.map +1 -0
  68. package/dist/injections/visual-edit-agent/state/agent-state.d.ts +17 -0
  69. package/dist/injections/visual-edit-agent/state/agent-state.d.ts.map +1 -0
  70. package/dist/injections/visual-edit-agent/state/agent-state.js +18 -0
  71. package/dist/injections/visual-edit-agent/state/agent-state.js.map +1 -0
  72. package/dist/injections/visual-edit-agent/ui/overlay.d.ts +26 -0
  73. package/dist/injections/visual-edit-agent/ui/overlay.d.ts.map +1 -0
  74. package/dist/injections/visual-edit-agent/ui/overlay.js +104 -0
  75. package/dist/injections/visual-edit-agent/ui/overlay.js.map +1 -0
  76. package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts +14 -0
  77. package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts.map +1 -0
  78. package/dist/injections/visual-edit-agent/utils/dom-utils.js +34 -0
  79. package/dist/injections/visual-edit-agent/utils/dom-utils.js.map +1 -0
  80. package/dist/injections/visual-edit-agent.d.ts +1 -1
  81. package/dist/injections/visual-edit-agent.d.ts.map +1 -1
  82. package/dist/injections/visual-edit-agent.js +1 -506
  83. package/dist/injections/visual-edit-agent.js.map +1 -1
  84. package/dist/jsx-processor.d.ts +1 -4
  85. package/dist/jsx-processor.d.ts.map +1 -1
  86. package/dist/jsx-processor.js +6 -33
  87. package/dist/jsx-processor.js.map +1 -1
  88. package/dist/jsx-utils.d.ts +0 -9
  89. package/dist/jsx-utils.d.ts.map +1 -1
  90. package/dist/jsx-utils.js +0 -86
  91. package/dist/jsx-utils.js.map +1 -1
  92. package/dist/processors/shared-utils.d.ts +0 -64
  93. package/dist/processors/shared-utils.d.ts.map +1 -1
  94. package/dist/processors/shared-utils.js +0 -468
  95. package/dist/processors/shared-utils.js.map +1 -1
  96. package/dist/processors/static-array-processor.d.ts +3 -2
  97. package/dist/processors/static-array-processor.d.ts.map +1 -1
  98. package/dist/processors/static-array-processor.js +3 -2
  99. package/dist/processors/static-array-processor.js.map +1 -1
  100. package/dist/statics/index.mjs +5 -1
  101. package/dist/statics/index.mjs.map +1 -1
  102. package/dist/visual-edit-plugin.d.ts +1 -0
  103. package/dist/visual-edit-plugin.d.ts.map +1 -1
  104. package/dist/visual-edit-plugin.js +178 -29
  105. package/dist/visual-edit-plugin.js.map +1 -1
  106. package/package.json +1 -1
  107. package/src/capabilities/inline-edit/controller.ts +245 -0
  108. package/src/capabilities/inline-edit/dom-utils.ts +48 -0
  109. package/src/capabilities/inline-edit/index.ts +2 -0
  110. package/src/capabilities/inline-edit/types.ts +30 -0
  111. package/src/injections/visual-edit-agent/README.md +222 -0
  112. package/src/injections/visual-edit-agent/capabilities/inline-editing/core.ts +120 -0
  113. package/src/injections/visual-edit-agent/capabilities/inline-editing/index.ts +10 -0
  114. package/src/injections/visual-edit-agent/capabilities/inline-editing/styles.ts +26 -0
  115. package/src/injections/visual-edit-agent/capabilities/inline-editing/validation.ts +87 -0
  116. package/src/injections/visual-edit-agent/constants.ts +9 -0
  117. package/src/injections/visual-edit-agent/handlers/click-handlers.ts +146 -0
  118. package/src/injections/visual-edit-agent/handlers/hover-handlers.ts +78 -0
  119. package/src/injections/visual-edit-agent/handlers/inline-edit-handlers.ts +146 -0
  120. package/src/injections/visual-edit-agent/handlers/message-handlers.ts +201 -0
  121. package/src/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.ts +65 -0
  122. package/src/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.ts +40 -0
  123. package/src/injections/visual-edit-agent/handlers/messages/types.ts +134 -0
  124. package/src/injections/visual-edit-agent/index.ts +121 -0
  125. package/src/injections/visual-edit-agent/state/agent-state.ts +31 -0
  126. package/src/injections/visual-edit-agent/ui/overlay.ts +126 -0
  127. package/src/injections/visual-edit-agent/utils/dom-utils.ts +39 -0
  128. package/src/injections/visual-edit-agent.ts +1 -625
  129. package/src/jsx-processor.ts +14 -41
  130. package/src/jsx-utils.ts +0 -116
  131. package/src/processors/shared-utils.ts +0 -596
  132. package/src/processors/static-array-processor.ts +3 -6
  133. package/src/visual-edit-plugin.ts +215 -34
  134. package/dist/consts.d.ts +0 -12
  135. package/dist/consts.d.ts.map +0 -1
  136. package/dist/consts.js +0 -12
  137. package/dist/consts.js.map +0 -1
  138. package/dist/processors/collection-id-processor.d.ts +0 -20
  139. package/dist/processors/collection-id-processor.d.ts.map +0 -1
  140. package/dist/processors/collection-id-processor.js +0 -182
  141. package/dist/processors/collection-id-processor.js.map +0 -1
  142. package/dist/processors/collection-item-field-processor.d.ts +0 -39
  143. package/dist/processors/collection-item-field-processor.d.ts.map +0 -1
  144. package/dist/processors/collection-item-field-processor.js +0 -281
  145. package/dist/processors/collection-item-field-processor.js.map +0 -1
  146. package/dist/processors/collection-item-id-processor.d.ts +0 -12
  147. package/dist/processors/collection-item-id-processor.d.ts.map +0 -1
  148. package/dist/processors/collection-item-id-processor.js +0 -50
  149. package/dist/processors/collection-item-id-processor.js.map +0 -1
  150. package/dist/processors/collection-reference-field-processor.d.ts +0 -31
  151. package/dist/processors/collection-reference-field-processor.d.ts.map +0 -1
  152. package/dist/processors/collection-reference-field-processor.js +0 -174
  153. package/dist/processors/collection-reference-field-processor.js.map +0 -1
  154. package/dist/processors/collection-tracing-utils.d.ts +0 -31
  155. package/dist/processors/collection-tracing-utils.d.ts.map +0 -1
  156. package/dist/processors/collection-tracing-utils.js +0 -326
  157. package/dist/processors/collection-tracing-utils.js.map +0 -1
  158. package/dist/types.d.ts +0 -5
  159. package/dist/types.d.ts.map +0 -1
  160. package/dist/types.js.map +0 -1
  161. package/src/consts.ts +0 -12
  162. package/src/processors/collection-id-processor.ts +0 -261
  163. package/src/processors/collection-item-field-processor.ts +0 -433
  164. package/src/processors/collection-item-id-processor.ts +0 -69
  165. package/src/processors/collection-reference-field-processor.ts +0 -225
  166. package/src/processors/collection-tracing-utils.ts +0 -436
  167. package/src/types.ts +0 -4
  168. /package/dist/{types.js → capabilities/inline-edit/types.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/injections/visual-edit-agent/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AACzD,eAAO,MAAM,eAAe,SAAS,CAAC;AACtC,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAC/C,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AACjE,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,iBAAiB,SAAS,CAAC;AACxC,eAAO,MAAM,mBAAmB,KAAK,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const INLINE_EDIT_DEBOUNCE_MS = 500;
2
+ export const OVERLAY_TRANSITION = "all 0.1s ease-in-out";
3
+ export const OVERLAY_Z_INDEX = "9999";
4
+ export const SELECTED_BORDER_COLOR = "#2563EB";
5
+ export const HOVER_BORDER_COLOR = "#95a5fc";
6
+ export const HOVER_BACKGROUND_COLOR = "rgba(99, 102, 241, 0.05)";
7
+ export const LABEL_TOP_OFFSET = "-27px";
8
+ export const LABEL_LEFT_OFFSET = "-2px";
9
+ export const REPOSITION_DELAY_MS = 50;
10
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/injections/visual-edit-agent/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { AgentState } from "../state/agent-state.js";
2
+ /**
3
+ * Handle element selection (first click)
4
+ */
5
+ export declare function handleElementSelection(state: AgentState, element: Element, visualSelectorId: string | null): void;
6
+ /**
7
+ * Handle element click
8
+ */
9
+ export declare function handleElementClick(state: AgentState, e: MouseEvent): void;
10
+ //# sourceMappingURL=click-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click-handlers.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/click-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAS1D;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,IAAI,CAwDN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,CAoEzE"}
@@ -0,0 +1,117 @@
1
+ import { OutgoingMessageType } from "./messages/types.js";
2
+ import { findElementsById } from "../../utils.js";
3
+ import { createOverlay, positionOverlay, clearSelection } from "../ui/overlay.js";
4
+ import { clearHoverOverlays } from "./hover-handlers.js";
5
+ import { shouldEnterInlineEditingMode } from "../capabilities/inline-editing/index.js";
6
+ import { handleClearInlineEditingMode, handleEnterInlineEditingMode } from "./inline-edit-handlers.js";
7
+ import { getElementPosition, getElementClasses } from "../utils/dom-utils.js";
8
+ /**
9
+ * Handle element selection (first click)
10
+ */
11
+ export function handleElementSelection(state, element, visualSelectorId) {
12
+ if (state.currentEditingElement) {
13
+ handleClearInlineEditingMode(state);
14
+ }
15
+ clearSelection(state);
16
+ // Find all elements with the same ID
17
+ const elements = findElementsById(visualSelectorId);
18
+ if (state.isInlineEditExperimentEnabled) {
19
+ elements.forEach((el) => {
20
+ if (el instanceof HTMLElement) {
21
+ el.dataset.selected = "true";
22
+ }
23
+ });
24
+ }
25
+ // Create selected overlays for all matching elements
26
+ elements.forEach((el) => {
27
+ const overlay = createOverlay(true);
28
+ document.body.appendChild(overlay);
29
+ state.selectedOverlays.push(overlay);
30
+ positionOverlay(overlay, el, true, state.isVisualEditMode);
31
+ });
32
+ state.selectedElementId = visualSelectorId;
33
+ // Clear hover overlays
34
+ clearHoverOverlays(state);
35
+ // Send message to parent window with element info
36
+ const htmlElement = element;
37
+ // Resolve static-array context from vite-plugin attributes (data-arr-*)
38
+ const arrEl = htmlElement.closest("[data-arr-variable-name]");
39
+ const staticArrayName = arrEl?.dataset?.arrVariableName || null;
40
+ const rawIdx = arrEl?.dataset?.arrIndex;
41
+ const staticArrayIndex = rawIdx != null ? parseInt(rawIdx, 10) : null;
42
+ const staticArrayField = htmlElement.dataset?.arrField || null;
43
+ const elementData = {
44
+ type: OutgoingMessageType.ELEMENT_SELECTED,
45
+ tagName: element.tagName,
46
+ classes: getElementClasses(element),
47
+ visualSelectorId: visualSelectorId,
48
+ content: htmlElement.innerText,
49
+ dataSourceLocation: htmlElement.dataset.sourceLocation,
50
+ isDynamicContent: htmlElement.dataset.dynamicContent === "true",
51
+ linenumber: htmlElement.dataset.linenumber,
52
+ filename: htmlElement.dataset.filename,
53
+ position: getElementPosition(element.getBoundingClientRect()),
54
+ staticArrayName,
55
+ staticArrayIndex,
56
+ staticArrayField,
57
+ };
58
+ window.parent.postMessage(elementData, "*");
59
+ }
60
+ /**
61
+ * Handle element click
62
+ */
63
+ export function handleElementClick(state, e) {
64
+ if (!state.isVisualEditMode)
65
+ return;
66
+ const target = e.target;
67
+ // Bail out early if clicking on a contentEditable element (allow normal editing)
68
+ if (state.isInlineEditExperimentEnabled && target instanceof HTMLElement && target.contentEditable === "true") {
69
+ return;
70
+ }
71
+ // If currently editing, clicking outside should exit editing mode
72
+ if (state.currentEditingElement) {
73
+ e.preventDefault();
74
+ e.stopPropagation();
75
+ e.stopImmediatePropagation();
76
+ handleClearInlineEditingMode(state);
77
+ return;
78
+ }
79
+ // Close dropdowns when clicking anywhere in iframe if a dropdown is open
80
+ if (state.isDropdownOpen) {
81
+ e.preventDefault();
82
+ e.stopPropagation();
83
+ e.stopImmediatePropagation();
84
+ window.parent.postMessage({ type: OutgoingMessageType.CLOSE_DROPDOWNS }, "*");
85
+ return;
86
+ }
87
+ // Prevent clicking on SVG path elements
88
+ if (target.tagName.toLowerCase() === "path") {
89
+ return;
90
+ }
91
+ // Prevent default behavior immediately when in visual edit mode
92
+ e.preventDefault();
93
+ e.stopPropagation();
94
+ e.stopImmediatePropagation();
95
+ // Support both data-source-location and data-visual-selector-id
96
+ const element = target.closest("[data-source-location], [data-visual-selector-id]");
97
+ if (!element) {
98
+ return;
99
+ }
100
+ const htmlElement = element;
101
+ const visualSelectorId = htmlElement.dataset.sourceLocation ||
102
+ htmlElement.dataset.visualSelectorId;
103
+ // Check if this element is already selected (second click scenario)
104
+ const isAlreadySelected = state.selectedElementId === visualSelectorId &&
105
+ htmlElement.dataset.selected === "true";
106
+ if (isAlreadySelected) {
107
+ // Second click on already-selected element: check if it should enter inline editing
108
+ // Only if the experiment is enabled
109
+ if (state.isInlineEditExperimentEnabled && shouldEnterInlineEditingMode(htmlElement)) {
110
+ handleEnterInlineEditingMode(state, htmlElement);
111
+ return;
112
+ }
113
+ }
114
+ // First click: select the element
115
+ handleElementSelection(state, element, visualSelectorId || null);
116
+ }
117
+ //# sourceMappingURL=click-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click-handlers.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/click-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAiB,EACjB,OAAgB,EAChB,gBAA+B;IAE/B,IA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D,OAAO;QACT,CAAC;IACH,CAAC;IAED,kCAAkC;IAClC,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,gBAAgB,IAAI,IAAI,CAAC,CAAC;AACnE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { AgentState } from "../state/agent-state.js";
2
+ /**
3
+ * Clear hover overlays
4
+ */
5
+ export declare function clearHoverOverlays(state: AgentState): void;
6
+ /**
7
+ * Handle mouse over event
8
+ */
9
+ export declare function handleMouseOver(state: AgentState, e: MouseEvent): void;
10
+ /**
11
+ * Handle mouse out event
12
+ */
13
+ export declare function handleMouseOut(state: AgentState): void;
14
+ //# sourceMappingURL=hover-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover-handlers.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/hover-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAI1D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,CAqDtE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAGtD"}
@@ -0,0 +1,64 @@
1
+ import { findElementsById } from "../../utils.js";
2
+ import { createOverlay, positionOverlay, clearOverlays } from "../ui/overlay.js";
3
+ /**
4
+ * Clear hover overlays
5
+ */
6
+ export function clearHoverOverlays(state) {
7
+ clearOverlays(state.hoverOverlays);
8
+ state.hoverOverlays = [];
9
+ state.currentHighlightedElements = [];
10
+ }
11
+ /**
12
+ * Handle mouse over event
13
+ */
14
+ export function handleMouseOver(state, e) {
15
+ if (!state.isVisualEditMode || state.isPopoverDragging || state.currentEditingElement)
16
+ return;
17
+ const target = e.target;
18
+ // Prevent hover effects when a dropdown is open
19
+ if (state.isDropdownOpen) {
20
+ clearHoverOverlays(state);
21
+ return;
22
+ }
23
+ // Prevent hover effects on SVG path elements
24
+ if (target.tagName.toLowerCase() === "path") {
25
+ clearHoverOverlays(state);
26
+ return;
27
+ }
28
+ // Support both data-source-location and data-visual-selector-id
29
+ const element = target.closest("[data-source-location], [data-visual-selector-id]");
30
+ if (!element) {
31
+ clearHoverOverlays(state);
32
+ return;
33
+ }
34
+ // Prefer data-source-location, fallback to data-visual-selector-id
35
+ const htmlElement = element;
36
+ const selectorId = htmlElement.dataset.sourceLocation ||
37
+ htmlElement.dataset.visualSelectorId;
38
+ // Skip if this element is already selected
39
+ if (state.selectedElementId === selectorId) {
40
+ clearHoverOverlays(state);
41
+ return;
42
+ }
43
+ // Find all elements with the same ID
44
+ const elements = findElementsById(selectorId || null);
45
+ // Clear previous hover overlays
46
+ clearHoverOverlays(state);
47
+ // Create overlays for all matching elements
48
+ elements.forEach((el) => {
49
+ const overlay = createOverlay(false);
50
+ document.body.appendChild(overlay);
51
+ state.hoverOverlays.push(overlay);
52
+ positionOverlay(overlay, el, false, state.isVisualEditMode);
53
+ });
54
+ state.currentHighlightedElements = elements;
55
+ }
56
+ /**
57
+ * Handle mouse out event
58
+ */
59
+ export function handleMouseOut(state) {
60
+ if (state.isPopoverDragging || state.currentEditingElement)
61
+ return;
62
+ clearHoverOverlays(state);
63
+ }
64
+ //# sourceMappingURL=hover-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover-handlers.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/hover-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjF;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAiB;IAClD,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC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,CAAC,EAAE,EAAE,EAAE;QACtB,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACnC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,eAAe,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,0BAA0B,GAAG,QAAQ,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,qBAAqB;QAAE,OAAO;IACnE,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { AgentState } from "../state/agent-state.js";
2
+ /**
3
+ * Enter inline editing mode
4
+ */
5
+ export declare function handleEnterInlineEditingMode(state: AgentState, element: HTMLElement): void;
6
+ /**
7
+ * Clear inline editing mode
8
+ */
9
+ export declare function handleClearInlineEditingMode(state: AgentState): void;
10
+ /**
11
+ * Setup inline edit callback
12
+ */
13
+ export declare function setupInlineEditCallback(state: AgentState): void;
14
+ //# sourceMappingURL=inline-edit-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-edit-handlers.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/inline-edit-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAY1D;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAmB1F;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CA+BpE;AAsED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAE/D"}
@@ -0,0 +1,114 @@
1
+ import { OutgoingMessageType } from "./messages/types.js";
2
+ import { repositionSelectedOverlays } from "../ui/overlay.js";
3
+ import { enterInlineEditingMode, clearInlineEditingMode, setInlineEditCallback, isStaticArrayTextElement, } from "../capabilities/inline-editing/index.js";
4
+ import { INLINE_EDIT_DEBOUNCE_MS } from "../constants.js";
5
+ import { getElementPosition, getElementClasses } from "../utils/dom-utils.js";
6
+ /**
7
+ * Enter inline editing mode
8
+ */
9
+ export function handleEnterInlineEditingMode(state, element) {
10
+ state.currentEditingElement = element;
11
+ // Hide overlays during editing
12
+ state.selectedOverlays.forEach((overlay) => {
13
+ overlay.style.display = "none";
14
+ });
15
+ // Enter inline editing mode (from capabilities/inline-editing)
16
+ enterInlineEditingMode(element);
17
+ // Notify parent
18
+ window.parent.postMessage({
19
+ type: OutgoingMessageType.CONTENT_EDITING_STARTED,
20
+ visualSelectorId: state.selectedElementId,
21
+ }, "*");
22
+ }
23
+ /**
24
+ * Clear inline editing mode
25
+ */
26
+ export function handleClearInlineEditingMode(state) {
27
+ if (!state.currentEditingElement)
28
+ return;
29
+ // Cancel any pending debounced edit — originalTextContent will be deleted below
30
+ if (state.debouncedSendTimeout) {
31
+ clearTimeout(state.debouncedSendTimeout);
32
+ state.debouncedSendTimeout = null;
33
+ }
34
+ const element = state.currentEditingElement;
35
+ // Clear inline editing mode (from capabilities/inline-editing)
36
+ clearInlineEditingMode(element);
37
+ // Show overlays again
38
+ state.selectedOverlays.forEach((overlay) => {
39
+ overlay.style.display = "";
40
+ });
41
+ repositionSelectedOverlays(state);
42
+ // Notify parent that editing ended
43
+ window.parent.postMessage({
44
+ type: OutgoingMessageType.CONTENT_EDITING_ENDED,
45
+ visualSelectorId: state.selectedElementId,
46
+ }, "*");
47
+ state.currentEditingElement = null;
48
+ }
49
+ /**
50
+ * Report inline edit to parent
51
+ */
52
+ function reportInlineEdit(state, element) {
53
+ const originalContent = element.dataset.originalTextContent;
54
+ const newContent = element.textContent;
55
+ const elementInfo = {
56
+ tagName: element.tagName,
57
+ classes: getElementClasses(element),
58
+ visualSelectorId: state.selectedElementId,
59
+ content: newContent,
60
+ dataSourceLocation: element.dataset.sourceLocation,
61
+ isDynamicContent: element.dataset.dynamicContent === "true",
62
+ linenumber: element.dataset.linenumber,
63
+ filename: element.dataset.filename,
64
+ position: getElementPosition(element.getBoundingClientRect()),
65
+ };
66
+ const message = {
67
+ type: OutgoingMessageType.INLINE_EDIT,
68
+ elementInfo,
69
+ originalContent,
70
+ newContent,
71
+ };
72
+ if (isStaticArrayTextElement(element)) {
73
+ message.arrIndex = element.dataset.arrIndex;
74
+ message.arrVariableName = element.dataset.arrVariableName;
75
+ message.arrField = element.dataset.arrField;
76
+ }
77
+ window.parent.postMessage(message, "*");
78
+ // Update baseline for next edit
79
+ element.dataset.originalTextContent = newContent || "";
80
+ }
81
+ /**
82
+ * Debounced function to send inline edit messages
83
+ *
84
+ * Intentionally overwrites the previous timeout on each keystroke — this is the
85
+ * correct debounce behavior. We only send ONE message 500ms after the user stops
86
+ * typing, containing the final text. Intermediate keystrokes are not sent to avoid
87
+ * flooding the parent with dozens of messages per second.
88
+ */
89
+ function debouncedSendInlineEditMessage(state, element) {
90
+ // Clear any existing timeout
91
+ if (state.debouncedSendTimeout) {
92
+ clearTimeout(state.debouncedSendTimeout);
93
+ }
94
+ // Set new timeout
95
+ state.debouncedSendTimeout = setTimeout(() => {
96
+ reportInlineEdit(state, element);
97
+ }, INLINE_EDIT_DEBOUNCE_MS);
98
+ }
99
+ /**
100
+ * Callback for text input changes (combines updatePosition and reportInlineEdit)
101
+ */
102
+ function createTextInputChangeCallback(state) {
103
+ return (element) => {
104
+ repositionSelectedOverlays(state);
105
+ debouncedSendInlineEditMessage(state, element);
106
+ };
107
+ }
108
+ /**
109
+ * Setup inline edit callback
110
+ */
111
+ export function setupInlineEditCallback(state) {
112
+ setInlineEditCallback(createTextInputChangeCallback(state));
113
+ }
114
+ //# sourceMappingURL=inline-edit-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-edit-handlers.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/inline-edit-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAiB,EAAE,OAAoB;IAClF,KAAK,CAAC,qBAAqB,GAAG,OAAO,CAAC;IAEtC,+BAA+B;IAC/B,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QACzC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,+DAA+D;IAC/D,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEhC,gBAAgB;IAChB,MAAM,CAAC,MAAM,CAAC,WAAW,CACvB;QACE,IAAI,EAAE,mBAAmB,CAAC,uBAAuB;QACjD,gBAAgB,EAAE,KAAK,CAAC,iBAAiB;KAC1C,EACD,GAAG,CACJ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAiB;IAC5D,IAAI,CAAC,KAAK,CAAC,qBAAqB;QAAE,OAAO;IAEzC,gFAAgF;IAChF,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC/B,YAAY,CAAC,KAAK,CAAC,oBAAoB,CAAC,CA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-0,0 +1,26 @@
1
+ import type { AgentState } from "../state/agent-state.js";
2
+ /**
3
+ * Unselect the current element
4
+ */
5
+ export declare function unselectElement(state: AgentState): void;
6
+ /**
7
+ * Update element classes and reposition overlays
8
+ */
9
+ export declare function updateElementClassesAndReposition(state: AgentState, visualSelectorId: string, classes: string): void;
10
+ /**
11
+ * Update element content by visual selector ID
12
+ */
13
+ export declare function updateElementContent(state: AgentState, visualSelectorId: string, content: string, arrIndex?: number): void;
14
+ /**
15
+ * Handle scroll events to update popover position
16
+ */
17
+ export declare function handleScroll(state: AgentState): void;
18
+ /**
19
+ * Handle window resize to reposition overlays
20
+ */
21
+ export declare function handleResize(state: AgentState): void;
22
+ /**
23
+ * Handle messages from parent window
24
+ */
25
+ export declare function handleMessage(state: AgentState, event: MessageEvent): void;
26
+ //# sourceMappingURL=message-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-handlers.d.ts","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/message-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAkC1D;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAKvD;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,UAAU,EACjB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CAoBN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAuBN;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEpD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAGpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,IAAI,CA4E1E"}
@@ -0,0 +1,148 @@
1
+ import { IncomingMessageType, OutgoingMessageType } from "./messages/types.js";
2
+ import { findElementsById, updateElementClasses } from "../../utils.js";
3
+ import { clearSelection, repositionSelectedOverlays, repositionHoverOverlays } from "../ui/overlay.js";
4
+ import { clearHoverOverlays } from "./hover-handlers.js";
5
+ import { handleClearInlineEditingMode } from "./inline-edit-handlers.js";
6
+ import { REPOSITION_DELAY_MS } from "../constants.js";
7
+ import { handleToggleVisualEditMode } from "./messages/toggle-visual-edit-mode.js";
8
+ import { handleToggleInlineEditMode } from "./messages/toggle-inline-edit-mode.js";
9
+ import { getElementPosition, isElementInViewport } from "../utils/dom-utils.js";
10
+ /**
11
+ * Send element position update to parent
12
+ */
13
+ function sendElementPositionUpdate(state) {
14
+ if (!state.selectedElementId)
15
+ return;
16
+ const elements = findElementsById(state.selectedElementId);
17
+ const [element] = elements;
18
+ if (!element)
19
+ return;
20
+ const rect = element.getBoundingClientRect();
21
+ window.parent.postMessage({
22
+ type: OutgoingMessageType.ELEMENT_POSITION_UPDATE,
23
+ position: getElementPosition(rect),
24
+ isInViewport: isElementInViewport(rect),
25
+ visualSelectorId: state.selectedElementId,
26
+ }, "*");
27
+ }
28
+ /**
29
+ * Unselect the current element
30
+ */
31
+ export function unselectElement(state) {
32
+ if (state.currentEditingElement) {
33
+ handleClearInlineEditingMode(state);
34
+ }
35
+ clearSelection(state);
36
+ }
37
+ /**
38
+ * Update element classes and reposition overlays
39
+ */
40
+ export function updateElementClassesAndReposition(state, visualSelectorId, classes) {
41
+ const elements = findElementsById(visualSelectorId);
42
+ if (elements.length === 0)
43
+ return;
44
+ updateElementClasses(elements, classes);
45
+ // Use a small delay to allow the browser to recalculate layout before repositioning
46
+ setTimeout(() => {
47
+ if (state.selectedElementId === visualSelectorId) {
48
+ repositionSelectedOverlays(state);
49
+ }
50
+ const hoveredElement = state.currentHighlightedElements[0];
51
+ if (hoveredElement instanceof HTMLElement &&
52
+ hoveredElement.dataset.visualSelectorId === visualSelectorId) {
53
+ repositionHoverOverlays(state);
54
+ }
55
+ }, REPOSITION_DELAY_MS);
56
+ }
57
+ /**
58
+ * Update element content by visual selector ID
59
+ */
60
+ export function updateElementContent(state, visualSelectorId, content, arrIndex) {
61
+ let elements = findElementsById(visualSelectorId);
62
+ if (elements.length === 0) {
63
+ return;
64
+ }
65
+ // If arrIndex is provided, only update the element at that array position
66
+ if (arrIndex != null) {
67
+ elements = elements.filter((el) => el.dataset.arrIndex === String(arrIndex));
68
+ }
69
+ elements.forEach((element) => {
70
+ element.innerText = content;
71
+ });
72
+ setTimeout(() => {
73
+ if (state.selectedElementId === visualSelectorId) {
74
+ repositionSelectedOverlays(state);
75
+ }
76
+ }, REPOSITION_DELAY_MS);
77
+ }
78
+ /**
79
+ * Handle scroll events to update popover position
80
+ */
81
+ export function handleScroll(state) {
82
+ sendElementPositionUpdate(state);
83
+ }
84
+ /**
85
+ * Handle window resize to reposition overlays
86
+ */
87
+ export function handleResize(state) {
88
+ repositionSelectedOverlays(state);
89
+ repositionHoverOverlays(state);
90
+ }
91
+ /**
92
+ * Handle messages from parent window
93
+ */
94
+ export function handleMessage(state, event) {
95
+ const message = event.data;
96
+ switch (message.type) {
97
+ case IncomingMessageType.TOGGLE_VISUAL_EDIT_MODE:
98
+ handleToggleVisualEditMode(state, message);
99
+ break;
100
+ case IncomingMessageType.UPDATE_CLASSES:
101
+ if (message.data && message.data.classes !== undefined) {
102
+ updateElementClassesAndReposition(state, message.data.visualSelectorId, message.data.classes);
103
+ }
104
+ else {
105
+ console.warn("[VisualEditAgent] Invalid update-classes message:", message);
106
+ }
107
+ break;
108
+ case IncomingMessageType.UNSELECT_ELEMENT:
109
+ unselectElement(state);
110
+ break;
111
+ case IncomingMessageType.REFRESH_PAGE:
112
+ window.location.reload();
113
+ break;
114
+ case IncomingMessageType.UPDATE_CONTENT:
115
+ if (message.data && message.data.content !== undefined) {
116
+ updateElementContent(state, message.data.visualSelectorId, message.data.content, message.data.arrIndex);
117
+ }
118
+ else {
119
+ console.warn("[VisualEditAgent] Invalid update-content message:", message);
120
+ }
121
+ break;
122
+ case IncomingMessageType.TOGGLE_INLINE_EDIT_MODE:
123
+ handleToggleInlineEditMode(state, message);
124
+ break;
125
+ case IncomingMessageType.REQUEST_ELEMENT_POSITION:
126
+ sendElementPositionUpdate(state);
127
+ break;
128
+ case IncomingMessageType.POPOVER_DRAG_STATE:
129
+ if (message.data && message.data.isDragging !== undefined) {
130
+ state.isPopoverDragging = message.data.isDragging;
131
+ if (message.data.isDragging) {
132
+ clearHoverOverlays(state);
133
+ }
134
+ }
135
+ break;
136
+ case IncomingMessageType.DROPDOWN_STATE:
137
+ if (message.data && message.data.isOpen !== undefined) {
138
+ state.isDropdownOpen = message.data.isOpen;
139
+ if (message.data.isOpen) {
140
+ clearHoverOverlays(state);
141
+ }
142
+ }
143
+ break;
144
+ default:
145
+ break;
146
+ }
147
+ }
148
+ //# sourceMappingURL=message-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-handlers.js","sourceRoot":"","sources":["../../../../src/injections/visual-edit-agent/handlers/message-handlers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,0B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AmB,CAAC,uBAAuB;YAC9C,0BAA0B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC3C,MAAM;QAER,KAAK,mBAAmB,CAAC,wBAAwB;YAC/C,yBAAyB,CAAC,KAAK,CAAC,CAAC;YACjC,MAAM;QAER,KAAK,mBAAmB,CAAC,kBAAkB;YACzC,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC1D,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;gBAClD,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;oBAC5B,kBAAkB,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,MAAM;QAER,KAAK,mBAAmB,CAAC,cAAc;YACrC,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACtD,KAAK,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACxB,kBAAkB,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,MAAM;QAER;YACE,MAAM;IACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { AgentState } from "../../state/agent-state.js";
2
+ import type { ToggleInlineEditModeMessage } from "./types.js";
3
+ /**
4
+ * Handle toggle-inline-edit-mode message (parent-initiated)
5
+ */
6
+ export declare function handleToggleInlineEditMode(state: AgentState, message: ToggleInlineEditModeMessage): void;
7
+ //# sourceMappingURL=toggle-inline-edit-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-inline-edit-mode.d.ts","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAO9D;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAkDN"}
@@ -0,0 +1,54 @@
1
+ import { findElementsById } from "../../../utils.js";
2
+ import { shouldEnterInlineEditingMode } from "../../capabilities/inline-editing/index.js";
3
+ import { handleEnterInlineEditingMode, handleClearInlineEditingMode } from "../inline-edit-handlers.js";
4
+ import { clearSelection } from "../../ui/overlay.js";
5
+ import { createOverlay, positionOverlay } from "../../ui/overlay.js";
6
+ /**
7
+ * Handle toggle-inline-edit-mode message (parent-initiated)
8
+ */
9
+ export function handleToggleInlineEditMode(state, message) {
10
+ if (!state.isInlineEditExperimentEnabled) {
11
+ return;
12
+ }
13
+ if (!message.data || !message.data.dataSourceLocation) {
14
+ return;
15
+ }
16
+ const elements = findElementsById(message.data.dataSourceLocation);
17
+ if (elements.length === 0 || !(elements[0] instanceof HTMLElement)) {
18
+ return;
19
+ }
20
+ const element = elements[0];
21
+ if (message.data.inlineEditingMode) {
22
+ // Enable inline editing (only for non-dynamic text elements)
23
+ if (shouldEnterInlineEditingMode(element)) {
24
+ // Select the element first if not already selected
25
+ if (state.selectedElementId !== message.data.dataSourceLocation) {
26
+ // Clear any existing selection
27
+ if (state.currentEditingElement) {
28
+ handleClearInlineEditingMode(state);
29
+ }
30
+ clearSelection(state);
31
+ elements.forEach((el) => {
32
+ if (el instanceof HTMLElement) {
33
+ el.dataset.selected = "true";
34
+ }
35
+ });
36
+ elements.forEach((el) => {
37
+ const overlay = createOverlay(true);
38
+ document.body.appendChild(overlay);
39
+ state.selectedOverlays.push(overlay);
40
+ positionOverlay(overlay, el, true, state.isVisualEditMode);
41
+ });
42
+ state.selectedElementId = message.data.dataSourceLocation;
43
+ }
44
+ handleEnterInlineEditingMode(state, element);
45
+ }
46
+ }
47
+ else {
48
+ // Disable inline editing
49
+ if (state.currentEditingElement === element) {
50
+ handleClearInlineEditingMode(state);
51
+ }
52
+ }
53
+ }
54
+ //# sourceMappingURL=toggle-inline-edit-mode.js.map