@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,185 +0,0 @@
|
|
|
1
|
-
/** DOM utilities for the layer-dropdown module */
|
|
2
|
-
|
|
3
|
-
import { isInstrumentedElement, getElementSelectorId } from "../utils.js";
|
|
4
|
-
import { MAX_PARENT_DEPTH, MAX_CHILD_DEPTH } from "./consts.js";
|
|
5
|
-
|
|
6
|
-
import type { LayerInfo } from "./types.js";
|
|
7
|
-
|
|
8
|
-
/** Apply a style map to an element */
|
|
9
|
-
export function applyStyles(element: HTMLElement, styles: Record<string, string>): void {
|
|
10
|
-
Object.assign(element.style, styles);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/** Display name for a layer — just the real tag name */
|
|
14
|
-
export function getLayerDisplayName(layer: LayerInfo): string {
|
|
15
|
-
return layer.tagName;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Collect instrumented descendants up to `maxDepth` instrumented nesting levels.
|
|
20
|
-
* Non-instrumented wrappers are walked through without counting toward depth.
|
|
21
|
-
* Results are in DOM order.
|
|
22
|
-
*/
|
|
23
|
-
export function getInstrumentedDescendants(
|
|
24
|
-
parent: Element,
|
|
25
|
-
maxDepth: number
|
|
26
|
-
): LayerInfo[] {
|
|
27
|
-
const result: LayerInfo[] = [];
|
|
28
|
-
|
|
29
|
-
function walk(el: Element, instrDepth: number): void {
|
|
30
|
-
if (instrDepth > maxDepth) return;
|
|
31
|
-
for (let i = 0; i < el.children.length; i++) {
|
|
32
|
-
const child = el.children[i]!;
|
|
33
|
-
if (isInstrumentedElement(child)) {
|
|
34
|
-
result.push({
|
|
35
|
-
element: child,
|
|
36
|
-
tagName: child.tagName.toLowerCase(),
|
|
37
|
-
selectorId: getElementSelectorId(child),
|
|
38
|
-
});
|
|
39
|
-
walk(child, instrDepth + 1);
|
|
40
|
-
} else {
|
|
41
|
-
walk(child, instrDepth);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
walk(parent, 1);
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function toLayerInfo(element: Element, depth?: number): LayerInfo {
|
|
51
|
-
const info: LayerInfo = {
|
|
52
|
-
element,
|
|
53
|
-
tagName: element.tagName.toLowerCase(),
|
|
54
|
-
selectorId: getElementSelectorId(element),
|
|
55
|
-
};
|
|
56
|
-
if (depth !== undefined) info.depth = depth;
|
|
57
|
-
return info;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Collect instrumented ancestors from selected element up to MAX_PARENT_DEPTH (outermost first). */
|
|
61
|
-
function collectInstrumentedParents(selectedElement: Element): LayerInfo[] {
|
|
62
|
-
const parents: LayerInfo[] = [];
|
|
63
|
-
let current = selectedElement.parentElement;
|
|
64
|
-
while (
|
|
65
|
-
current &&
|
|
66
|
-
current !== document.documentElement &&
|
|
67
|
-
current !== document.body &&
|
|
68
|
-
parents.length < MAX_PARENT_DEPTH
|
|
69
|
-
) {
|
|
70
|
-
if (isInstrumentedElement(current)) {
|
|
71
|
-
parents.push(toLayerInfo(current));
|
|
72
|
-
}
|
|
73
|
-
current = current.parentElement;
|
|
74
|
-
}
|
|
75
|
-
parents.reverse();
|
|
76
|
-
return parents;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** Append parents to chain with depth 0, 1, …; returns depth of selected (parents.length). */
|
|
80
|
-
function appendParentsWithDepth(chain: LayerInfo[], parents: LayerInfo[]): number {
|
|
81
|
-
parents.forEach((p, i) => {
|
|
82
|
-
chain.push({ ...p, depth: i });
|
|
83
|
-
});
|
|
84
|
-
return parents.length;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** Append selected element and its descendants at the given depth. */
|
|
88
|
-
function appendSelfAndDescendants(
|
|
89
|
-
chain: LayerInfo[],
|
|
90
|
-
selectedElement: Element,
|
|
91
|
-
selfDepth: number
|
|
92
|
-
): void {
|
|
93
|
-
chain.push(toLayerInfo(selectedElement, selfDepth));
|
|
94
|
-
const descendants = getInstrumentedDescendants(
|
|
95
|
-
selectedElement,
|
|
96
|
-
MAX_CHILD_DEPTH
|
|
97
|
-
);
|
|
98
|
-
assignDescendantDepths(selectedElement, descendants, selfDepth + 1);
|
|
99
|
-
chain.push(...descendants);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** Get the innermost instrumented parent's DOM element, or null if none. */
|
|
103
|
-
function getImmediateInstrParent(parents: LayerInfo[]): Element | null {
|
|
104
|
-
return parents.length > 0 ? parents[parents.length - 1]!.element : null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** Collect instrumented siblings of the selected element from its parent (DOM order). */
|
|
108
|
-
function collectSiblings(parent: Element, selectedElement: Element): LayerInfo[] {
|
|
109
|
-
const siblings = getInstrumentedDescendants(parent, 1);
|
|
110
|
-
if (!siblings.some((s) => s.element === selectedElement)) {
|
|
111
|
-
siblings.push(toLayerInfo(selectedElement));
|
|
112
|
-
}
|
|
113
|
-
return siblings;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/** Append siblings at selfDepth, expanding children only for the selected element. */
|
|
117
|
-
function appendSiblingsWithSelected(
|
|
118
|
-
chain: LayerInfo[],
|
|
119
|
-
siblings: LayerInfo[],
|
|
120
|
-
selectedElement: Element,
|
|
121
|
-
selfDepth: number
|
|
122
|
-
): void {
|
|
123
|
-
for (const sibling of siblings) {
|
|
124
|
-
if (sibling.element === selectedElement) {
|
|
125
|
-
appendSelfAndDescendants(chain, selectedElement, selfDepth);
|
|
126
|
-
} else {
|
|
127
|
-
chain.push({ ...sibling, depth: selfDepth });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Build the layer chain for the dropdown:
|
|
134
|
-
*
|
|
135
|
-
* Parents – up to MAX_PARENT_DEPTH instrumented ancestors, outer → inner.
|
|
136
|
-
* Siblings – instrumented children of the immediate parent, at the same depth.
|
|
137
|
-
* Current – the selected element (highlighted), with children expanded.
|
|
138
|
-
* Children – instrumented descendants within MAX_CHILD_DEPTH levels, DOM order.
|
|
139
|
-
*
|
|
140
|
-
* Each item carries a `depth` for visual indentation.
|
|
141
|
-
*/
|
|
142
|
-
export function buildLayerChain(selectedElement: Element): LayerInfo[] {
|
|
143
|
-
const parents = collectInstrumentedParents(selectedElement);
|
|
144
|
-
const chain: LayerInfo[] = [];
|
|
145
|
-
const selfDepth = appendParentsWithDepth(chain, parents);
|
|
146
|
-
|
|
147
|
-
const instrParent = getImmediateInstrParent(parents);
|
|
148
|
-
if (instrParent) {
|
|
149
|
-
const siblings = collectSiblings(instrParent, selectedElement);
|
|
150
|
-
appendSiblingsWithSelected(chain, siblings, selectedElement, selfDepth);
|
|
151
|
-
} else {
|
|
152
|
-
appendSelfAndDescendants(chain, selectedElement, selfDepth);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
return chain;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Walk the DOM tree again to assign correct visual depth to each descendant.
|
|
160
|
-
* This avoids storing depth during collection and keeps the API simple.
|
|
161
|
-
*/
|
|
162
|
-
function assignDescendantDepths(
|
|
163
|
-
root: Element,
|
|
164
|
-
descendants: LayerInfo[],
|
|
165
|
-
startDepth: number
|
|
166
|
-
): void {
|
|
167
|
-
// Build a set for O(1) lookup
|
|
168
|
-
const descSet = new Set(descendants.map((d) => d.element));
|
|
169
|
-
// Map element → LayerInfo for mutation
|
|
170
|
-
const descMap = new Map(descendants.map((d) => [d.element, d]));
|
|
171
|
-
|
|
172
|
-
function walk(el: Element, instrDepth: number): void {
|
|
173
|
-
for (let i = 0; i < el.children.length; i++) {
|
|
174
|
-
const child = el.children[i]!;
|
|
175
|
-
if (descSet.has(child)) {
|
|
176
|
-
descMap.get(child)!.depth = startDepth + instrDepth - 1;
|
|
177
|
-
walk(child, instrDepth + 1);
|
|
178
|
-
} else {
|
|
179
|
-
walk(child, instrDepth);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
walk(root, 1);
|
|
185
|
-
}
|