@base44-preview/vite-plugin 0.2.26-pr.43.e9195be → 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 -33
  143. package/dist/processors/collection-item-field-processor.d.ts.map +0 -1
  144. package/dist/processors/collection-item-field-processor.js +0 -275
  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 -410
  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,3 @@
1
+ import type { InlineEditHost, InlineEditController } from "./types.js";
2
+ export declare function createInlineEditController(host: InlineEditHost): InlineEditController;
3
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAUvE,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,cAAc,GACnB,oBAAoB,CAwOtB"}
@@ -0,0 +1,194 @@
1
+ import { injectFocusOutlineCSS, removeFocusOutlineCSS, selectText, shouldEnterInlineEditingMode, } from "./dom-utils.js";
2
+ const DEBOUNCE_MS = 500;
3
+ export function createInlineEditController(host) {
4
+ let currentEditingElement = null;
5
+ let debouncedSendTimeout = null;
6
+ let enabled = false;
7
+ const listenerAbortControllers = new WeakMap();
8
+ // --- Private helpers ---
9
+ const repositionOverlays = () => {
10
+ const selectedId = host.getSelectedElementId();
11
+ if (!selectedId)
12
+ return;
13
+ const elements = host.findElementsById(selectedId);
14
+ const overlays = host.getSelectedOverlays();
15
+ overlays.forEach((overlay, i) => {
16
+ if (i < elements.length && elements[i]) {
17
+ host.positionOverlay(overlay, elements[i]);
18
+ }
19
+ });
20
+ };
21
+ const reportEdit = (element) => {
22
+ const originalContent = element.dataset.originalTextContent;
23
+ const newContent = element.textContent;
24
+ const svgElement = element;
25
+ const rect = element.getBoundingClientRect();
26
+ window.parent.postMessage({
27
+ type: "inline-edit",
28
+ elementInfo: {
29
+ tagName: element.tagName,
30
+ classes: svgElement.className?.baseVal ||
31
+ element.className ||
32
+ "",
33
+ visualSelectorId: host.getSelectedElementId(),
34
+ content: newContent,
35
+ dataSourceLocation: element.dataset.sourceLocation,
36
+ isDynamicContent: element.dataset.dynamicContent === "true",
37
+ linenumber: element.dataset.linenumber,
38
+ filename: element.dataset.filename,
39
+ position: {
40
+ top: rect.top,
41
+ left: rect.left,
42
+ right: rect.right,
43
+ bottom: rect.bottom,
44
+ width: rect.width,
45
+ height: rect.height,
46
+ centerX: rect.left + rect.width / 2,
47
+ centerY: rect.top + rect.height / 2,
48
+ },
49
+ },
50
+ originalContent,
51
+ newContent,
52
+ }, "*");
53
+ element.dataset.originalTextContent = newContent || "";
54
+ };
55
+ const debouncedReport = (element) => {
56
+ if (debouncedSendTimeout)
57
+ clearTimeout(debouncedSendTimeout);
58
+ debouncedSendTimeout = setTimeout(() => reportEdit(element), DEBOUNCE_MS);
59
+ };
60
+ const onTextInput = (element) => {
61
+ repositionOverlays();
62
+ debouncedReport(element);
63
+ };
64
+ const handleInputEvent = function () {
65
+ onTextInput(this);
66
+ };
67
+ const makeEditable = (element) => {
68
+ injectFocusOutlineCSS();
69
+ element.dataset.originalTextContent = element.textContent || "";
70
+ element.dataset.originalCursor = element.style.cursor;
71
+ element.contentEditable = "true";
72
+ const abortController = new AbortController();
73
+ listenerAbortControllers.set(element, abortController);
74
+ element.addEventListener("input", handleInputEvent, {
75
+ signal: abortController.signal,
76
+ });
77
+ element.style.cursor = "text";
78
+ selectText(element);
79
+ setTimeout(() => {
80
+ if (element.isConnected) {
81
+ element.focus();
82
+ }
83
+ }, 0);
84
+ };
85
+ const makeNonEditable = (element) => {
86
+ const abortController = listenerAbortControllers.get(element);
87
+ if (abortController) {
88
+ abortController.abort();
89
+ listenerAbortControllers.delete(element);
90
+ }
91
+ if (!element.isConnected)
92
+ return;
93
+ removeFocusOutlineCSS();
94
+ element.contentEditable = "false";
95
+ delete element.dataset.originalTextContent;
96
+ if (element.dataset.originalCursor !== undefined) {
97
+ element.style.cursor = element.dataset.originalCursor;
98
+ delete element.dataset.originalCursor;
99
+ }
100
+ };
101
+ // --- Public API ---
102
+ return {
103
+ get enabled() {
104
+ return enabled;
105
+ },
106
+ set enabled(value) {
107
+ enabled = value;
108
+ },
109
+ isEditing() {
110
+ return currentEditingElement !== null;
111
+ },
112
+ getCurrentElement() {
113
+ return currentEditingElement;
114
+ },
115
+ canEdit(element) {
116
+ return shouldEnterInlineEditingMode(element);
117
+ },
118
+ startEditing(element) {
119
+ currentEditingElement = element;
120
+ host.getSelectedOverlays().forEach((o) => {
121
+ o.style.display = "none";
122
+ });
123
+ makeEditable(element);
124
+ window.parent.postMessage({
125
+ type: "content-editing-started",
126
+ visualSelectorId: host.getSelectedElementId(),
127
+ }, "*");
128
+ },
129
+ stopEditing() {
130
+ if (!currentEditingElement)
131
+ return;
132
+ if (debouncedSendTimeout) {
133
+ clearTimeout(debouncedSendTimeout);
134
+ debouncedSendTimeout = null;
135
+ }
136
+ const element = currentEditingElement;
137
+ makeNonEditable(element);
138
+ host.getSelectedOverlays().forEach((o) => {
139
+ o.style.display = "";
140
+ });
141
+ repositionOverlays();
142
+ window.parent.postMessage({
143
+ type: "content-editing-ended",
144
+ visualSelectorId: host.getSelectedElementId(),
145
+ }, "*");
146
+ currentEditingElement = null;
147
+ },
148
+ markElementsSelected(elements) {
149
+ elements.forEach((el) => {
150
+ if (el instanceof HTMLElement) {
151
+ el.dataset.selected = "true";
152
+ }
153
+ });
154
+ },
155
+ clearSelectedMarks(elementId) {
156
+ if (!elementId)
157
+ return;
158
+ host.findElementsById(elementId).forEach((el) => {
159
+ if (el instanceof HTMLElement) {
160
+ delete el.dataset.selected;
161
+ }
162
+ });
163
+ },
164
+ handleToggleMessage(data) {
165
+ if (!enabled)
166
+ return;
167
+ const elements = host.findElementsById(data.dataSourceLocation);
168
+ if (elements.length === 0 || !(elements[0] instanceof HTMLElement))
169
+ return;
170
+ const element = elements[0];
171
+ if (data.inlineEditingMode) {
172
+ if (!shouldEnterInlineEditingMode(element))
173
+ return;
174
+ // Select the element first if not already selected
175
+ if (host.getSelectedElementId() !== data.dataSourceLocation) {
176
+ this.stopEditing();
177
+ host.clearSelection();
178
+ this.markElementsSelected(elements);
179
+ host.createSelectionOverlays(elements, data.dataSourceLocation);
180
+ }
181
+ this.startEditing(element);
182
+ }
183
+ else {
184
+ if (currentEditingElement === element) {
185
+ this.stopEditing();
186
+ }
187
+ }
188
+ },
189
+ cleanup() {
190
+ this.stopEditing();
191
+ },
192
+ };
193
+ }
194
+ //# sourceMappingURL=controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/controller.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,EACV,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,UAAU,0BAA0B,CACxC,IAAoB;IAEpB,IAAI,qBAAqB,GAAuB,IAAI,CAAC;IACrD,IAAI,oB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D,mDAAmD;gBACnD,IAAI,IAAI,CAAC,oBAAoB,EAAE,KAAK,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC5D,IAAI,CAAC,WAAW,EAAE,CAAC;oBACnB,IAAI,CAAC,cAAc,EAAE,CAAC;oBACtB,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;oBACpC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;gBAClE,CAAC;gBACD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,IAAI,qBAAqB,KAAK,OAAO,EAAE,CAAC;oBACtC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const injectFocusOutlineCSS: () => void;
2
+ export declare const removeFocusOutlineCSS: () => void;
3
+ export declare const selectText: (element: HTMLElement) => void;
4
+ export declare const isEditableTextElement: (element: Element) => boolean;
5
+ export declare const shouldEnterInlineEditingMode: (element: Element) => boolean;
6
+ //# sourceMappingURL=dom-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.d.ts","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/dom-utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB,YAWjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,YAEjC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,SAAS,WAAW,SAM9C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,SAAS,OAAO,KAAG,OAQxD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,SAAS,OAAO,KAAG,OAK/D,CAAC"}
@@ -0,0 +1,49 @@
1
+ const FOCUS_STYLE_ID = "visual-edit-focus-styles";
2
+ const EDITABLE_TAGS = [
3
+ "div", "p", "h1", "h2", "h3", "h4", "h5", "h6",
4
+ "span", "li", "td", "a", "button", "label",
5
+ ];
6
+ export const injectFocusOutlineCSS = () => {
7
+ if (document.getElementById(FOCUS_STYLE_ID))
8
+ return;
9
+ const style = document.createElement("style");
10
+ style.id = FOCUS_STYLE_ID;
11
+ style.textContent = `
12
+ [data-selected="true"][contenteditable="true"]:focus {
13
+ outline: none !important;
14
+ }
15
+ `;
16
+ document.head.appendChild(style);
17
+ };
18
+ export const removeFocusOutlineCSS = () => {
19
+ document.getElementById(FOCUS_STYLE_ID)?.remove();
20
+ };
21
+ export const selectText = (element) => {
22
+ const range = document.createRange();
23
+ range.selectNodeContents(element);
24
+ const selection = window.getSelection();
25
+ selection?.removeAllRanges();
26
+ selection?.addRange(range);
27
+ };
28
+ export const isEditableTextElement = (element) => {
29
+ if (!(element instanceof HTMLElement))
30
+ return false;
31
+ if (!EDITABLE_TAGS.includes(element.tagName.toLowerCase()))
32
+ return false;
33
+ if (!element.textContent?.trim())
34
+ return false;
35
+ if (element.querySelector("img, video, canvas, svg"))
36
+ return false;
37
+ if (element.children?.length > 0)
38
+ return false;
39
+ if (element.dataset.dynamicContent === "true")
40
+ return false;
41
+ return true;
42
+ };
43
+ export const shouldEnterInlineEditingMode = (element) => {
44
+ if (!(element instanceof HTMLElement) || element.dataset.selected !== "true") {
45
+ return false;
46
+ }
47
+ return isEditableTextElement(element);
48
+ };
49
+ //# sourceMappingURL=dom-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom-utils.js","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/dom-utils.ts"],"names":[],"mappings":"AAAA,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAElD,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC9C,MAAM,EAAE,IAAI,E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C,yBAAyB,CAAC;QAAE,OAAO,KAAK,CAAC;IACnE,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,OAAgB,EAAW,EAAE;IACxE,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAC7E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createInlineEditController } from "./controller.js";
2
+ export type { InlineEditController, InlineEditHost } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createInlineEditController } from "./controller.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export interface InlineEditHost {
2
+ findElementsById(id: string | null): Element[];
3
+ getSelectedElementId(): string | null;
4
+ getSelectedOverlays(): HTMLDivElement[];
5
+ positionOverlay(overlay: HTMLDivElement, element: Element, isSelected?: boolean): void;
6
+ clearSelection(): void;
7
+ createSelectionOverlays(elements: Element[], elementId: string): void;
8
+ }
9
+ export interface ToggleInlineEditData {
10
+ dataSourceLocation: string;
11
+ inlineEditingMode: boolean;
12
+ }
13
+ export interface InlineEditController {
14
+ enabled: boolean;
15
+ isEditing(): boolean;
16
+ getCurrentElement(): HTMLElement | null;
17
+ canEdit(element: Element): boolean;
18
+ startEditing(element: HTMLElement): void;
19
+ stopEditing(): void;
20
+ markElementsSelected(elements: Element[]): void;
21
+ clearSelectedMarks(elementId: string | null): void;
22
+ handleToggleMessage(data: ToggleInlineEditData): void;
23
+ cleanup(): void;
24
+ }
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,EAAE,CAAC;IAC/C,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAAC;IACtC,mBAAmB,IAAI,cAAc,EAAE,CAAC;IACxC,eAAe,CACb,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,OAAO,GACnB,IAAI,CAAC;IACR,cAAc,IAAI,IAAI,CAAC;IACvB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,oBAAoB;IACnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,IAAI,OAAO,CAAC;IACrB,iBAAiB,IAAI,WAAW,GAAG,IAAI,CAAC;IACxC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;IACnC,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC,WAAW,IAAI,IAAI,CAAC;IACpB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChD,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACnD,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;CACjB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/capabilities/inline-edit/types.ts"],"names":[],"mappings":""}
@@ -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;AAkBD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAYtE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CA4BjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CA0BjE"}
@@ -0,0 +1,95 @@
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
+ * WeakMap to track AbortControllers for each element's input listener.
16
+ * Using WeakMap ensures no memory leaks — when an element is garbage collected,
17
+ * its entry is automatically removed.
18
+ */
19
+ const listenerAbortControllers = new WeakMap();
20
+ /**
21
+ * Internal handler for the native input event
22
+ */
23
+ function handleInputEvent(e) {
24
+ if (onTextInputChangeCallback) {
25
+ onTextInputChangeCallback(this);
26
+ }
27
+ }
28
+ /**
29
+ * Check if an element should enter inline editing mode
30
+ * Called when user clicks on an already-selected element
31
+ */
32
+ export function shouldEnterInlineEditingMode(element) {
33
+ // Must have data-selected="true"
34
+ if (!(element instanceof HTMLElement) || element.dataset.selected !== "true") {
35
+ return false;
36
+ }
37
+ // Must pass all editability checks
38
+ if (!isEditableTextElement(element)) {
39
+ return false;
40
+ }
41
+ return true;
42
+ }
43
+ /**
44
+ * Enable contentEditable mode on an element
45
+ * Follows the exact flow from inlineEdit.md
46
+ */
47
+ export function enterInlineEditingMode(element) {
48
+ // Inject CSS to suppress focus outline
49
+ injectFocusOutlineCSS();
50
+ // Store original state
51
+ element.dataset.originalTextContent = element.textContent || "";
52
+ element.dataset.originalCursor = element.style.cursor;
53
+ // Enable contentEditable
54
+ element.contentEditable = "true";
55
+ // Create an AbortController to manage the input listener lifecycle
56
+ const abortController = new AbortController();
57
+ listenerAbortControllers.set(element, abortController);
58
+ // Add input event listener with AbortSignal for automatic cleanup
59
+ element.addEventListener("input", handleInputEvent, { signal: abortController.signal });
60
+ // Set cursor to text
61
+ element.style.cursor = "text";
62
+ // Select all text
63
+ selectText(element);
64
+ // Focus after render
65
+ setTimeout(() => {
66
+ element.focus();
67
+ }, 0);
68
+ }
69
+ /**
70
+ * Disable contentEditable mode on an element
71
+ * Reverses everything done by enterInlineEditingMode
72
+ */
73
+ export function clearInlineEditingMode(element) {
74
+ // Abort the input event listener using the stored AbortController
75
+ const abortController = listenerAbortControllers.get(element);
76
+ if (abortController) {
77
+ abortController.abort();
78
+ listenerAbortControllers.delete(element);
79
+ }
80
+ // If element was removed from DOM before cleanup, skip DOM operations
81
+ if (!element.isConnected) {
82
+ return;
83
+ }
84
+ removeFocusOutlineCSS();
85
+ // Disable contentEditable
86
+ element.contentEditable = "false";
87
+ // Remove stored original text content
88
+ delete element.dataset.originalTextContent;
89
+ // Restore original cursor
90
+ if (element.dataset.originalCursor !== undefined) {
91
+ element.style.cursor = element.dataset.originalCursor;
92
+ delete element.dataset.originalCursor;
93
+ }
94
+ }
95
+ //# 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;AAOpE;;;GAGG;AACH,IAAI,yBAAyB,GAA6B,IAAI,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAkC;IACtE,yBAAyB,GAAG,QAAQ,CAAC;AACvC,CAAC;AAED;;;;GA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AAO,CAAC,CAAC;IAEpB,qBAAqB;IACrB,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,EAAE,CAAC,CAAC,CAAC;AACR,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAoB;IACzD,kEAAkE;IAClE,MAAM,eAAe,GAAG,wBAAwB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9D,IAAI,eAAe,EAAE,CAAC;QACpB,eAAe,CAAC,KAAK,EAAE,CAAC;QACxB,wBAAwB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,sEAAsE;IACtE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzB,OAAO;IACT,CAAC;IAED,qBAAqB,EAAE,CAAC;IAExB,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, isStaticArrayTextElement, 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,wBAAwB,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, isStaticArrayTextElement, 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,wBAAwB,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,17 @@
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 a static array text element.
7
+ * These elements are "dynamic" (they reference item.field) but their source
8
+ * is a compile-time static array, so they can be safely edited inline.
9
+ */
10
+ export declare function isStaticArrayTextElement(element: HTMLElement): boolean;
11
+ /**
12
+ * Check if an element is an editable text element
13
+ * Based on the eligibility rules from inlineEdit.md (non-dynamic only),
14
+ * with an exception for static array elements.
15
+ */
16
+ export declare function isEditableTextElement(element: Element): boolean;
17
+ //# 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;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAEtE;AA4CD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAmB/D"}
@@ -0,0 +1,76 @@
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 a static array text element.
13
+ * These elements are "dynamic" (they reference item.field) but their source
14
+ * is a compile-time static array, so they can be safely edited inline.
15
+ */
16
+ export function isStaticArrayTextElement(element) {
17
+ return !!element.dataset.arrField;
18
+ }
19
+ const ALLOWED_INLINE_EDIT_TAGS = [
20
+ "div",
21
+ "p",
22
+ "h1",
23
+ "h2",
24
+ "h3",
25
+ "h4",
26
+ "h5",
27
+ "h6",
28
+ "span",
29
+ "li",
30
+ "td",
31
+ "a",
32
+ "button",
33
+ "label",
34
+ ];
35
+ /**
36
+ * Structural checks shared by both regular and static-array inline editing:
37
+ * allowed tag, non-empty text, no media children, leaf node.
38
+ */
39
+ function passesStructuralChecks(element) {
40
+ if (!ALLOWED_INLINE_EDIT_TAGS.includes(element.tagName.toLowerCase())) {
41
+ return false;
42
+ }
43
+ const textContent = element.textContent?.trim() || "";
44
+ if (textContent.length === 0) {
45
+ return false;
46
+ }
47
+ if (element.querySelector("img, video, canvas, svg") !== null) {
48
+ return false;
49
+ }
50
+ if (element.children.length > 0) {
51
+ return false;
52
+ }
53
+ return true;
54
+ }
55
+ /**
56
+ * Check if an element is an editable text element
57
+ * Based on the eligibility rules from inlineEdit.md (non-dynamic only),
58
+ * with an exception for static array elements.
59
+ */
60
+ export function isEditableTextElement(element) {
61
+ if (!(element instanceof HTMLElement)) {
62
+ return false;
63
+ }
64
+ if (!passesStructuralChecks(element)) {
65
+ return false;
66
+ }
67
+ // Static array elements are editable even though they are technically "dynamic"
68
+ if (isStaticArrayTextElement(element)) {
69
+ return true;
70
+ }
71
+ if (element.dataset.dynamicContent === "true") {
72
+ return false;
73
+ }
74
+ return true;
75
+ }
76
+ //# 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;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC;AACpC,CAAC;AAED,MAAM,wBA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I,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