@base44-preview/vite-plugin 0.2.22-pr.36.d652cb1 → 0.2.22-pr.37.466ee63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/injections/utils.d.ts +0 -6
- package/dist/injections/utils.d.ts.map +1 -1
- package/dist/injections/utils.js +0 -25
- package/dist/injections/utils.js.map +1 -1
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts +25 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js +78 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/core.js.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts +4 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js +4 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/index.js.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts +9 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js +26 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/styles.js.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts +10 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js +60 -0
- package/dist/injections/visual-edit-agent/capabilities/inline-editing/validation.js.map +1 -0
- package/dist/injections/visual-edit-agent/constants.d.ts +10 -0
- package/dist/injections/visual-edit-agent/constants.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/constants.js +10 -0
- package/dist/injections/visual-edit-agent/constants.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts +10 -0
- package/dist/injections/visual-edit-agent/handlers/click-handlers.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/click-handlers.js +109 -0
- package/dist/injections/visual-edit-agent/handlers/click-handlers.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts +14 -0
- package/dist/injections/visual-edit-agent/handlers/hover-handlers.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/hover-handlers.js +64 -0
- package/dist/injections/visual-edit-agent/handlers/hover-handlers.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts +14 -0
- package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js +99 -0
- package/dist/injections/visual-edit-agent/handlers/inline-edit-handlers.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts +26 -0
- package/dist/injections/visual-edit-agent/handlers/message-handlers.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/message-handlers.js +145 -0
- package/dist/injections/visual-edit-agent/handlers/message-handlers.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts +7 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js +42 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts +11 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js +33 -0
- package/dist/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.js.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts +86 -0
- package/dist/injections/visual-edit-agent/handlers/messages/types.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/handlers/messages/types.js +28 -0
- package/dist/injections/visual-edit-agent/handlers/messages/types.js.map +1 -0
- package/dist/injections/visual-edit-agent/index.d.ts +5 -0
- package/dist/injections/visual-edit-agent/index.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/index.js +100 -0
- package/dist/injections/visual-edit-agent/index.js.map +1 -0
- package/dist/injections/visual-edit-agent/state/agent-state.d.ts +17 -0
- package/dist/injections/visual-edit-agent/state/agent-state.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/state/agent-state.js +18 -0
- package/dist/injections/visual-edit-agent/state/agent-state.js.map +1 -0
- package/dist/injections/visual-edit-agent/ui/overlay.d.ts +26 -0
- package/dist/injections/visual-edit-agent/ui/overlay.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/ui/overlay.js +103 -0
- package/dist/injections/visual-edit-agent/ui/overlay.js.map +1 -0
- package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts +14 -0
- package/dist/injections/visual-edit-agent/utils/dom-utils.d.ts.map +1 -0
- package/dist/injections/visual-edit-agent/utils/dom-utils.js +34 -0
- package/dist/injections/visual-edit-agent/utils/dom-utils.js.map +1 -0
- package/dist/injections/visual-edit-agent.d.ts +1 -1
- package/dist/injections/visual-edit-agent.d.ts.map +1 -1
- package/dist/injections/visual-edit-agent.js +1 -474
- package/dist/injections/visual-edit-agent.js.map +1 -1
- package/dist/statics/index.mjs +5 -1
- package/dist/statics/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/injections/utils.ts +0 -34
- package/src/injections/visual-edit-agent/README.md +222 -0
- package/src/injections/visual-edit-agent/capabilities/inline-editing/core.ts +100 -0
- package/src/injections/visual-edit-agent/capabilities/inline-editing/index.ts +10 -0
- package/src/injections/visual-edit-agent/capabilities/inline-editing/styles.ts +26 -0
- package/src/injections/visual-edit-agent/capabilities/inline-editing/validation.ts +67 -0
- package/src/injections/visual-edit-agent/constants.ts +9 -0
- package/src/injections/visual-edit-agent/handlers/click-handlers.ts +135 -0
- package/src/injections/visual-edit-agent/handlers/hover-handlers.ts +78 -0
- package/src/injections/visual-edit-agent/handlers/inline-edit-handlers.ts +130 -0
- package/src/injections/visual-edit-agent/handlers/message-handlers.ts +191 -0
- package/src/injections/visual-edit-agent/handlers/messages/toggle-inline-edit-mode.ts +51 -0
- package/src/injections/visual-edit-agent/handlers/messages/toggle-visual-edit-mode.ts +41 -0
- package/src/injections/visual-edit-agent/handlers/messages/types.ts +112 -0
- package/src/injections/visual-edit-agent/index.ts +116 -0
- package/src/injections/visual-edit-agent/state/agent-state.ts +31 -0
- package/src/injections/visual-edit-agent/ui/overlay.ts +125 -0
- package/src/injections/visual-edit-agent/utils/dom-utils.ts +39 -0
- package/src/injections/visual-edit-agent.ts +1 -577
- package/dist/injections/layer-dropdown/consts.d.ts +0 -15
- package/dist/injections/layer-dropdown/consts.d.ts.map +0 -1
- package/dist/injections/layer-dropdown/consts.js +0 -36
- package/dist/injections/layer-dropdown/consts.js.map +0 -1
- package/dist/injections/layer-dropdown/controller.d.ts +0 -4
- package/dist/injections/layer-dropdown/controller.d.ts.map +0 -1
- package/dist/injections/layer-dropdown/controller.js +0 -85
- package/dist/injections/layer-dropdown/controller.js.map +0 -1
- package/dist/injections/layer-dropdown/dropdown-ui.d.ts +0 -13
- package/dist/injections/layer-dropdown/dropdown-ui.d.ts.map +0 -1
- package/dist/injections/layer-dropdown/dropdown-ui.js +0 -158
- package/dist/injections/layer-dropdown/dropdown-ui.js.map +0 -1
- package/dist/injections/layer-dropdown/types.d.ts +0 -21
- package/dist/injections/layer-dropdown/types.d.ts.map +0 -1
- package/dist/injections/layer-dropdown/types.js +0 -3
- package/dist/injections/layer-dropdown/types.js.map +0 -1
- package/dist/injections/layer-dropdown/utils.d.ts +0 -24
- package/dist/injections/layer-dropdown/utils.d.ts.map +0 -1
- package/dist/injections/layer-dropdown/utils.js +0 -150
- package/dist/injections/layer-dropdown/utils.js.map +0 -1
- package/src/injections/layer-dropdown/LAYERS.md +0 -258
- package/src/injections/layer-dropdown/consts.ts +0 -44
- package/src/injections/layer-dropdown/controller.ts +0 -105
- package/src/injections/layer-dropdown/dropdown-ui.ts +0 -221
- package/src/injections/layer-dropdown/types.ts +0 -24
- package/src/injections/layer-dropdown/utils.ts +0 -185
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/** Check if an element has instrumentation attributes */
|
|
2
|
-
export declare function isInstrumentedElement(element: Element): boolean;
|
|
3
|
-
/** Get the selector ID from an element's data attributes (prefers source-location) */
|
|
4
|
-
export declare function getElementSelectorId(element: Element): string | null;
|
|
5
|
-
/** Find the nearest instrumented ancestor (not the element itself) */
|
|
6
|
-
export declare function getImmediateInstrumentedParent(element: Element): Element | null;
|
|
7
1
|
/** Find elements by ID - first try data-source-location, fallback to data-visual-selector-id */
|
|
8
2
|
export declare function findElementsById(id: string | null): Element[];
|
|
9
3
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/injections/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/injections/utils.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,EAAE,CAW7D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI/E"}
|
package/dist/injections/utils.js
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/** Check if an element has instrumentation attributes */
|
|
2
|
-
export function isInstrumentedElement(element) {
|
|
3
|
-
const htmlEl = element;
|
|
4
|
-
return !!(htmlEl.dataset?.sourceLocation || htmlEl.dataset?.visualSelectorId);
|
|
5
|
-
}
|
|
6
|
-
/** Get the selector ID from an element's data attributes (prefers source-location) */
|
|
7
|
-
export function getElementSelectorId(element) {
|
|
8
|
-
const htmlEl = element;
|
|
9
|
-
return (htmlEl.dataset?.sourceLocation ||
|
|
10
|
-
htmlEl.dataset?.visualSelectorId ||
|
|
11
|
-
null);
|
|
12
|
-
}
|
|
13
|
-
/** Find the nearest instrumented ancestor (not the element itself) */
|
|
14
|
-
export function getImmediateInstrumentedParent(element) {
|
|
15
|
-
let current = element.parentElement;
|
|
16
|
-
while (current &&
|
|
17
|
-
current !== document.documentElement &&
|
|
18
|
-
current !== document.body) {
|
|
19
|
-
if (isInstrumentedElement(current)) {
|
|
20
|
-
return current;
|
|
21
|
-
}
|
|
22
|
-
current = current.parentElement;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
1
|
/** Find elements by ID - first try data-source-location, fallback to data-visual-selector-id */
|
|
27
2
|
export function findElementsById(id) {
|
|
28
3
|
if (!id)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/injections/utils.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/injections/utils.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,MAAM,UAAU,gBAAgB,CAAC,EAAiB;IAChD,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,CAAC;IACnB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAC/B,QAAQ,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAC5D,CAAC;IACF,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CACf,QAAQ,CAAC,gBAAgB,CAAC,6BAA6B,EAAE,IAAI,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAmB,EAAE,OAAe;IACvE,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Callback function type for handling text input changes
|
|
3
|
+
*/
|
|
4
|
+
type OnTextInputChange = (element: HTMLElement) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Set the callback function that will be called on text input changes
|
|
7
|
+
*/
|
|
8
|
+
export declare function setInlineEditCallback(callback: OnTextInputChange | null): void;
|
|
9
|
+
/**
|
|
10
|
+
* Check if an element should enter inline editing mode
|
|
11
|
+
* Called when user clicks on an already-selected element
|
|
12
|
+
*/
|
|
13
|
+
export declare function shouldEnterInlineEditingMode(element: Element): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Enable contentEditable mode on an element
|
|
16
|
+
* Follows the exact flow from inlineEdit.md
|
|
17
|
+
*/
|
|
18
|
+
export declare function enterInlineEditingMode(element: HTMLElement): void;
|
|
19
|
+
/**
|
|
20
|
+
* Disable contentEditable mode on an element
|
|
21
|
+
* Reverses everything done by enterInlineEditingMode
|
|
22
|
+
*/
|
|
23
|
+
export declare function clearInlineEditingMode(element: HTMLElement): void;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/core.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,KAAK,iBAAiB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;AAQxD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAE9E;AAWD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAwBjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAiBjE"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { injectFocusOutlineCSS, removeFocusOutlineCSS } from "./styles.js";
|
|
2
|
+
import { selectText, isEditableTextElement } from "./validation.js";
|
|
3
|
+
/**
|
|
4
|
+
* Global callback that gets triggered on every input event
|
|
5
|
+
* This is set by the visual-edit-agent and includes both updatePosition and reportInlineEdit
|
|
6
|
+
*/
|
|
7
|
+
let onTextInputChangeCallback = null;
|
|
8
|
+
/**
|
|
9
|
+
* Set the callback function that will be called on text input changes
|
|
10
|
+
*/
|
|
11
|
+
export function setInlineEditCallback(callback) {
|
|
12
|
+
onTextInputChangeCallback = callback;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Internal handler for the native input event
|
|
16
|
+
*/
|
|
17
|
+
function handleInputEvent(e) {
|
|
18
|
+
if (onTextInputChangeCallback) {
|
|
19
|
+
onTextInputChangeCallback(this);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check if an element should enter inline editing mode
|
|
24
|
+
* Called when user clicks on an already-selected element
|
|
25
|
+
*/
|
|
26
|
+
export function shouldEnterInlineEditingMode(element) {
|
|
27
|
+
// Must have data-selected="true"
|
|
28
|
+
if (!(element instanceof HTMLElement) || element.dataset.selected !== "true") {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// Must pass all editability checks
|
|
32
|
+
if (!isEditableTextElement(element)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Enable contentEditable mode on an element
|
|
39
|
+
* Follows the exact flow from inlineEdit.md
|
|
40
|
+
*/
|
|
41
|
+
export function enterInlineEditingMode(element) {
|
|
42
|
+
// Inject CSS to suppress focus outline
|
|
43
|
+
injectFocusOutlineCSS();
|
|
44
|
+
// Store original state
|
|
45
|
+
element.dataset.originalTextContent = element.textContent || "";
|
|
46
|
+
element.dataset.originalCursor = element.style.cursor;
|
|
47
|
+
// Enable contentEditable
|
|
48
|
+
element.contentEditable = "true";
|
|
49
|
+
// Add input event listener
|
|
50
|
+
element.addEventListener("input", handleInputEvent);
|
|
51
|
+
// Set cursor to text
|
|
52
|
+
element.style.cursor = "text";
|
|
53
|
+
// Select all text
|
|
54
|
+
selectText(element);
|
|
55
|
+
// Focus after render
|
|
56
|
+
setTimeout(() => {
|
|
57
|
+
element.focus();
|
|
58
|
+
}, 0);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Disable contentEditable mode on an element
|
|
62
|
+
* Reverses everything done by enterInlineEditingMode
|
|
63
|
+
*/
|
|
64
|
+
export function clearInlineEditingMode(element) {
|
|
65
|
+
removeFocusOutlineCSS();
|
|
66
|
+
// Remove input event listener
|
|
67
|
+
element.removeEventListener("input", handleInputEvent);
|
|
68
|
+
// Disable contentEditable
|
|
69
|
+
element.contentEditable = "false";
|
|
70
|
+
// Remove stored original text content
|
|
71
|
+
delete element.dataset.originalTextContent;
|
|
72
|
+
// Restore original cursor
|
|
73
|
+
if (element.dataset.originalCursor !== undefined) {
|
|
74
|
+
element.style.cursor = element.dataset.originalCursor;
|
|
75
|
+
delete element.dataset.originalCursor;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC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AC,KAAK,EAAE,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAoB;IACzD,qBAAqB,EAAE,CAAC;IAExB,8BAA8B;IAC9B,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAEvD,0BAA0B;IAC1B,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC;IAElC,sCAAsC;IACtC,OAAO,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAE3C,0BAA0B;IAC1B,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;QACtD,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { enterInlineEditingMode, clearInlineEditingMode, shouldEnterInlineEditingMode, setInlineEditCallback, } from "./core.js";
|
|
2
|
+
export { injectFocusOutlineCSS, removeFocusOutlineCSS } from "./styles.js";
|
|
3
|
+
export { isEditableTextElement, selectText } from "./validation.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { enterInlineEditingMode, clearInlineEditingMode, shouldEnterInlineEditingMode, setInlineEditCallback, } from "./core.js";
|
|
2
|
+
export { injectFocusOutlineCSS, removeFocusOutlineCSS } from "./styles.js";
|
|
3
|
+
export { isEditableTextElement, selectText } from "./validation.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject CSS to suppress the browser's default focus outline on contentEditable elements
|
|
3
|
+
*/
|
|
4
|
+
export declare function injectFocusOutlineCSS(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Remove the injected focus outline CSS
|
|
7
|
+
*/
|
|
8
|
+
export declare function removeFocusOutlineCSS(): void;
|
|
9
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAY5C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAK5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inject CSS to suppress the browser's default focus outline on contentEditable elements
|
|
3
|
+
*/
|
|
4
|
+
export function injectFocusOutlineCSS() {
|
|
5
|
+
const existingStyle = document.getElementById("visual-edit-focus-styles");
|
|
6
|
+
if (existingStyle)
|
|
7
|
+
return;
|
|
8
|
+
const style = document.createElement("style");
|
|
9
|
+
style.id = "visual-edit-focus-styles";
|
|
10
|
+
style.textContent = `
|
|
11
|
+
[data-selected="true"][contenteditable="true"]:focus {
|
|
12
|
+
outline: none !important;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
document.head.appendChild(style);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Remove the injected focus outline CSS
|
|
19
|
+
*/
|
|
20
|
+
export function removeFocusOutlineCSS() {
|
|
21
|
+
const style = document.getElementById("visual-edit-focus-styles");
|
|
22
|
+
if (style) {
|
|
23
|
+
style.remove();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;IAC1E,IAAI,aAAa;QAAE,OAAO;IAE1B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,GAAG,0BAA0B,CAAC;IACtC,KAAK,CAAC,WAAW,GAAG;;;;GAInB,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,0BAA0B,CAAC,CAAC;IAClE,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select all text content in an element using the Selection API
|
|
3
|
+
*/
|
|
4
|
+
export declare function selectText(element: HTMLElement): void;
|
|
5
|
+
/**
|
|
6
|
+
* Check if an element is an editable text element
|
|
7
|
+
* Based on the eligibility rules from inlineEdit.md (non-dynamic only)
|
|
8
|
+
*/
|
|
9
|
+
export declare function isEditableTextElement(element: Element): boolean;
|
|
10
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAMrD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAmD/D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select all text content in an element using the Selection API
|
|
3
|
+
*/
|
|
4
|
+
export function selectText(element) {
|
|
5
|
+
const range = document.createRange();
|
|
6
|
+
range.selectNodeContents(element);
|
|
7
|
+
const selection = window.getSelection();
|
|
8
|
+
selection?.removeAllRanges();
|
|
9
|
+
selection?.addRange(range);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Check if an element is an editable text element
|
|
13
|
+
* Based on the eligibility rules from inlineEdit.md (non-dynamic only)
|
|
14
|
+
*/
|
|
15
|
+
export function isEditableTextElement(element) {
|
|
16
|
+
// Must be an HTMLElement
|
|
17
|
+
if (!(element instanceof HTMLElement)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// Must be an allowed tag
|
|
21
|
+
const allowedTags = [
|
|
22
|
+
"div",
|
|
23
|
+
"p",
|
|
24
|
+
"h1",
|
|
25
|
+
"h2",
|
|
26
|
+
"h3",
|
|
27
|
+
"h4",
|
|
28
|
+
"h5",
|
|
29
|
+
"h6",
|
|
30
|
+
"span",
|
|
31
|
+
"li",
|
|
32
|
+
"td",
|
|
33
|
+
"a",
|
|
34
|
+
"button",
|
|
35
|
+
"label",
|
|
36
|
+
];
|
|
37
|
+
if (!allowedTags.includes(element.tagName.toLowerCase())) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
// Must have text content
|
|
41
|
+
const textContent = element.textContent?.trim() || "";
|
|
42
|
+
if (textContent.length === 0) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// Must NOT contain img, video, canvas, or svg
|
|
46
|
+
const hasMediaElements = element.querySelector("img, video, canvas, svg") !== null;
|
|
47
|
+
if (hasMediaElements) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
// Must NOT have complex children (must be a leaf text node or simple container)
|
|
51
|
+
if (element.children.length > 0) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
// Must NOT be dynamic content
|
|
55
|
+
if (element.dataset.dynamicContent === "true") {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../../src/injections/visual-edit-agent/capabilities/inline-editing/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,OAAoB;IAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;IACxC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC7B,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,yBAAyB;IACzB,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yBAAyB;IACzB,MAAM,WAAW,GAAG;QAClB,KAAK;QACL,GAAG;QACH,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,IAAI;QACJ,IAAI;QACJ,GAAG;QACH,QAAQ;QACR,OAAO;KACR,CAAC;IACF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,yBAAyB;IACzB,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8CAA8C;IAC9C,MAAM,gBAAgB,GACpB,OAAO,CAAC,aAAa,CAAC,yBAAyB,CAAC,KAAK,IAAI,CAAC;IAC5D,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,gFAAgF;IAChF,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,8BAA8B;IAC9B,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const INLINE_EDIT_DEBOUNCE_MS = 500;
|
|
2
|
+
export declare const OVERLAY_TRANSITION = "all 0.1s ease-in-out";
|
|
3
|
+
export declare const OVERLAY_Z_INDEX = "9999";
|
|
4
|
+
export declare const SELECTED_BORDER_COLOR = "#2563EB";
|
|
5
|
+
export declare const HOVER_BORDER_COLOR = "#95a5fc";
|
|
6
|
+
export declare const HOVER_BACKGROUND_COLOR = "rgba(99, 102, 241, 0.05)";
|
|
7
|
+
export declare const LABEL_TOP_OFFSET = "-27px";
|
|
8
|
+
export declare const LABEL_LEFT_OFFSET = "-2px";
|
|
9
|
+
export declare const REPOSITION_DELAY_MS = 50;
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -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;AAU1D;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAC9B,IAAI,CAyCN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,CAuEzE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { OutgoingMessageType } from "./messages/types.js";
|
|
2
|
+
import { findElementsById } from "../../utils.js";
|
|
3
|
+
import { createOverlay, positionOverlay } 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 { unselectElement } from "./message-handlers.js";
|
|
8
|
+
import { getElementPosition, getElementClasses } from "../utils/dom-utils.js";
|
|
9
|
+
/**
|
|
10
|
+
* Handle element selection (first click)
|
|
11
|
+
*/
|
|
12
|
+
export function handleElementSelection(state, element, visualSelectorId) {
|
|
13
|
+
unselectElement(state);
|
|
14
|
+
// Find all elements with the same ID
|
|
15
|
+
const elements = findElementsById(visualSelectorId);
|
|
16
|
+
// Mark elements as selected
|
|
17
|
+
elements.forEach((el) => {
|
|
18
|
+
if (el instanceof HTMLElement) {
|
|
19
|
+
el.dataset.selected = "true";
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
// Create selected overlays for all matching elements
|
|
23
|
+
elements.forEach((el) => {
|
|
24
|
+
const overlay = createOverlay(true);
|
|
25
|
+
document.body.appendChild(overlay);
|
|
26
|
+
state.selectedOverlays.push(overlay);
|
|
27
|
+
positionOverlay(overlay, el, true, state.isVisualEditMode);
|
|
28
|
+
});
|
|
29
|
+
state.selectedElementId = visualSelectorId;
|
|
30
|
+
// Clear hover overlays
|
|
31
|
+
clearHoverOverlays(state);
|
|
32
|
+
// Send message to parent window with element info
|
|
33
|
+
const htmlElement = element;
|
|
34
|
+
const elementData = {
|
|
35
|
+
type: OutgoingMessageType.ELEMENT_SELECTED,
|
|
36
|
+
tagName: element.tagName,
|
|
37
|
+
classes: getElementClasses(element),
|
|
38
|
+
visualSelectorId: visualSelectorId,
|
|
39
|
+
content: htmlElement.innerText,
|
|
40
|
+
dataSourceLocation: htmlElement.dataset.sourceLocation,
|
|
41
|
+
isDynamicContent: htmlElement.dataset.dynamicContent === "true",
|
|
42
|
+
linenumber: htmlElement.dataset.linenumber,
|
|
43
|
+
filename: htmlElement.dataset.filename,
|
|
44
|
+
position: getElementPosition(element.getBoundingClientRect()),
|
|
45
|
+
};
|
|
46
|
+
window.parent.postMessage(elementData, "*");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handle element click
|
|
50
|
+
*/
|
|
51
|
+
export function handleElementClick(state, e) {
|
|
52
|
+
if (!state.isVisualEditMode)
|
|
53
|
+
return;
|
|
54
|
+
const target = e.target;
|
|
55
|
+
// Bail out early if clicking on a contentEditable element (allow normal editing)
|
|
56
|
+
if (target instanceof HTMLElement && target.contentEditable === "true") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// If currently editing, clicking outside should exit editing mode
|
|
60
|
+
if (state.currentEditingElement) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
e.stopImmediatePropagation();
|
|
64
|
+
handleClearInlineEditingMode(state);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Close dropdowns when clicking anywhere in iframe if a dropdown is open
|
|
68
|
+
if (state.isDropdownOpen) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
e.stopImmediatePropagation();
|
|
72
|
+
window.parent.postMessage({ type: OutgoingMessageType.CLOSE_DROPDOWNS }, "*");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Prevent clicking on SVG path elements
|
|
76
|
+
if (target.tagName.toLowerCase() === "path") {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// Prevent default behavior immediately when in visual edit mode
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
e.stopImmediatePropagation();
|
|
83
|
+
// Support both data-source-location and data-visual-selector-id
|
|
84
|
+
const element = target.closest("[data-source-location], [data-visual-selector-id]");
|
|
85
|
+
if (!element) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const htmlElement = element;
|
|
89
|
+
const visualSelectorId = htmlElement.dataset.sourceLocation ||
|
|
90
|
+
htmlElement.dataset.visualSelectorId;
|
|
91
|
+
// Check if this element is already selected (second click scenario)
|
|
92
|
+
const isAlreadySelected = state.selectedElementId === visualSelectorId &&
|
|
93
|
+
htmlElement.dataset.selected === "true";
|
|
94
|
+
if (isAlreadySelected) {
|
|
95
|
+
// Second click on already-selected element: check if it should enter inline editing
|
|
96
|
+
// Only if the experiment is enabled
|
|
97
|
+
if (state.isInlineEditExperimentEnabled && shouldEnterInlineEditingMode(htmlElement)) {
|
|
98
|
+
console.log('[VisualEditAgent] Entering inline edit mode');
|
|
99
|
+
handleEnterInlineEditingMode(state, htmlElement);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
else if (!state.isInlineEditExperimentEnabled) {
|
|
103
|
+
console.log('[VisualEditAgent] Inline edit disabled - experiment flag not enabled');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// First click: select the element
|
|
107
|
+
handleElementSelection(state, element, visualSelectorId || null);
|
|
108
|
+
}
|
|
109
|
+
//# 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,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,kBAAkB,E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,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;IACnC,KAAK,CAAC,aAAa,GAAG,EAAE,CAAC;IACzB,KAAK,CAAC,0BAA0B,GAAG,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB,EAAE,CAAa;IAC9D,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,iBAAiB,IAAI,KAAK,CAAC,qBAAqB;QAAE,OAAO;IAE9F,MAAM,MAAM,GAAG,CAAC,CAAC,MAAiB,CAAC;IAEnC,gDAAgD;IAChD,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,6CAA6C;IAC7C,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QAC5C,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,gEAAgE;IAChE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC5B,mDAAmD,CACpD,CAAC;IACF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,mEAAmE;IACnE,MAAM,WAAW,GAAG,OAAsB,CAAC;IAC3C,MAAM,UAAU,GACd,WAAW,CAAC,OAAO,CAAC,cAAc;QAClC,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,KAAK,CAAC,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC3C,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IAED,qCAAqC;IACrC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC;IAEtD,gCAAgC;IAChC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE1B,4CAA4C;IAC5C,QAAQ,CAAC,OAAO,CAAC,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;AAW1D;;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,CAyBpE;AA6DD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAE/D"}
|