@archie/devtools 0.0.35 → 0.0.37
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/client/client.js +163 -2
- package/dist/client/client.mjs +163 -2
- package/dist/inspector.standalone.js +940 -74
- package/package.json +1 -1
package/dist/client/client.js
CHANGED
|
@@ -4085,6 +4085,46 @@ function DragOverlay2() {
|
|
|
4085
4085
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DragOverlay, { dropAnimation: null, children: renderContent() });
|
|
4086
4086
|
}
|
|
4087
4087
|
|
|
4088
|
+
// src/client/dnd/design-mode/debug-trace.ts
|
|
4089
|
+
var MAX_ENTRIES = 800;
|
|
4090
|
+
function traceWindow() {
|
|
4091
|
+
return typeof window === "undefined" ? null : window;
|
|
4092
|
+
}
|
|
4093
|
+
function isVeDebugEnabled() {
|
|
4094
|
+
const w = traceWindow();
|
|
4095
|
+
if (!w) return false;
|
|
4096
|
+
if (w.__ARCHIE_VE_DEBUG__ === true || w._inspectorDebug === true) return true;
|
|
4097
|
+
try {
|
|
4098
|
+
return w.localStorage?.getItem("ARCHIE_VE_DEBUG") === "1";
|
|
4099
|
+
} catch {
|
|
4100
|
+
return false;
|
|
4101
|
+
}
|
|
4102
|
+
}
|
|
4103
|
+
function veTrace(layer, event, data) {
|
|
4104
|
+
const w = traceWindow();
|
|
4105
|
+
if (!w) return;
|
|
4106
|
+
let resolved;
|
|
4107
|
+
if (typeof data === "function") {
|
|
4108
|
+
try {
|
|
4109
|
+
resolved = data();
|
|
4110
|
+
} catch (error) {
|
|
4111
|
+
resolved = { __traceDataError: String(error) };
|
|
4112
|
+
}
|
|
4113
|
+
} else {
|
|
4114
|
+
resolved = data;
|
|
4115
|
+
}
|
|
4116
|
+
const entry = { t: Date.now(), layer, event, ...resolved === void 0 ? {} : { data: resolved } };
|
|
4117
|
+
const buffer = w.__ARCHIE_VE_TRACE__ ?? (w.__ARCHIE_VE_TRACE__ = []);
|
|
4118
|
+
buffer.push(entry);
|
|
4119
|
+
if (buffer.length > MAX_ENTRIES) buffer.splice(0, buffer.length - MAX_ENTRIES);
|
|
4120
|
+
if (!w.__ARCHIE_VE_TRACE_DUMP__) {
|
|
4121
|
+
w.__ARCHIE_VE_TRACE_DUMP__ = () => JSON.stringify(w.__ARCHIE_VE_TRACE__ ?? []);
|
|
4122
|
+
}
|
|
4123
|
+
if (isVeDebugEnabled()) {
|
|
4124
|
+
console.log(`[archie-ve:${layer}]`, event, resolved ?? "");
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4088
4128
|
// src/client/dnd/design-mode/host-bridge.ts
|
|
4089
4129
|
var DEFAULT_INSPECTOR_THEME = {
|
|
4090
4130
|
accent: "#8b5cf6",
|
|
@@ -4094,8 +4134,80 @@ var DEFAULT_INSPECTOR_THEME = {
|
|
|
4094
4134
|
};
|
|
4095
4135
|
var HOST_COMMAND_EVENT = "archie:editor-host-command";
|
|
4096
4136
|
var DND_RUNTIME_EVENT = "archie:dnd-runtime-event";
|
|
4137
|
+
function summarizeIdentity(identity2) {
|
|
4138
|
+
if (!identity2) return null;
|
|
4139
|
+
return {
|
|
4140
|
+
nodeId: identity2.nodeId,
|
|
4141
|
+
nodeKey: identity2.nodeKey,
|
|
4142
|
+
ref: identity2.inspectorRef ? `${identity2.inspectorRef.relativePath}:${identity2.inspectorRef.line}:${identity2.inspectorRef.column}` : null,
|
|
4143
|
+
...identity2.effectiveNodeId && identity2.effectiveNodeId !== identity2.nodeId ? { effectiveNodeId: identity2.effectiveNodeId } : {}
|
|
4144
|
+
};
|
|
4145
|
+
}
|
|
4146
|
+
function summarizeRuntimeEvent(detail) {
|
|
4147
|
+
switch (detail.type) {
|
|
4148
|
+
case "element-moved":
|
|
4149
|
+
return {
|
|
4150
|
+
operationId: detail.operationId,
|
|
4151
|
+
commandType: detail.commandType,
|
|
4152
|
+
selected: summarizeIdentity(detail.selected),
|
|
4153
|
+
anchor: summarizeIdentity(detail.anchor),
|
|
4154
|
+
container: summarizeIdentity(detail.container),
|
|
4155
|
+
beforeSibling: summarizeIdentity(detail.beforeSibling),
|
|
4156
|
+
sourceContainer: summarizeIdentity(detail.sourceContainer),
|
|
4157
|
+
diagnostics: detail.diagnostics ?? null
|
|
4158
|
+
};
|
|
4159
|
+
case "element-resized":
|
|
4160
|
+
return {
|
|
4161
|
+
operationId: detail.operationId,
|
|
4162
|
+
selected: summarizeIdentity(detail.selected),
|
|
4163
|
+
anchor: summarizeIdentity(detail.anchor),
|
|
4164
|
+
resize: {
|
|
4165
|
+
mode: detail.resize.mode,
|
|
4166
|
+
selectedNodeKey: detail.resize.selectedNodeKey,
|
|
4167
|
+
targetNodeKey: detail.resize.targetNodeKey,
|
|
4168
|
+
targetNodeId: detail.resize.targetNodeId,
|
|
4169
|
+
width: detail.resize.width,
|
|
4170
|
+
height: detail.resize.height
|
|
4171
|
+
}
|
|
4172
|
+
};
|
|
4173
|
+
case "element-inserted":
|
|
4174
|
+
return {
|
|
4175
|
+
operationId: detail.operationId,
|
|
4176
|
+
nodeId: detail.nodeId,
|
|
4177
|
+
nodeKey: detail.nodeKey,
|
|
4178
|
+
displayName: detail.displayName,
|
|
4179
|
+
container: summarizeIdentity(detail.container),
|
|
4180
|
+
index: detail.index,
|
|
4181
|
+
beforeSibling: summarizeIdentity(detail.beforeSibling),
|
|
4182
|
+
hasTsxCode: !!detail.tsxCode,
|
|
4183
|
+
htmlLength: detail.html?.length ?? 0
|
|
4184
|
+
};
|
|
4185
|
+
case "arrange-session-changed":
|
|
4186
|
+
return {
|
|
4187
|
+
mode: detail.session.mode,
|
|
4188
|
+
canUndo: detail.session.canUndo,
|
|
4189
|
+
changeCount: detail.session.changes.length,
|
|
4190
|
+
changes: detail.session.changes.map((c) => ({
|
|
4191
|
+
id: c.id,
|
|
4192
|
+
kind: c.kind,
|
|
4193
|
+
operationId: c.operationId,
|
|
4194
|
+
nodeKey: c.nodeKey,
|
|
4195
|
+
ref: c.inspectorRef ? `${c.inspectorRef.relativePath}:${c.inspectorRef.line}:${c.inspectorRef.column}` : null
|
|
4196
|
+
}))
|
|
4197
|
+
};
|
|
4198
|
+
case "arrange-undo-applied":
|
|
4199
|
+
return { success: detail.success, updatedAt: detail.updatedAt };
|
|
4200
|
+
case "design-mode-changed":
|
|
4201
|
+
return { mode: detail.mode };
|
|
4202
|
+
case "design-mode-error":
|
|
4203
|
+
return { error: detail.error };
|
|
4204
|
+
default:
|
|
4205
|
+
return null;
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4097
4208
|
function dispatchRuntimeEvent(detail) {
|
|
4098
4209
|
if (typeof window === "undefined") return;
|
|
4210
|
+
veTrace("dnd", `runtime-event:${detail.type}`, () => summarizeRuntimeEvent(detail));
|
|
4099
4211
|
window.dispatchEvent(new CustomEvent(DND_RUNTIME_EVENT, { detail }));
|
|
4100
4212
|
}
|
|
4101
4213
|
function resolveRowBinding(el) {
|
|
@@ -8196,8 +8308,23 @@ function useDragLifecycle({
|
|
|
8196
8308
|
if (refs.resizeSessionRef.current || Date.now() < refs.resizeDragBlockUntilRef.current) return;
|
|
8197
8309
|
const activeId = active.id;
|
|
8198
8310
|
const found = refs.draggableNodeMapRef.current.get(activeId) ?? refs.nodeMapRef.current.get(activeId);
|
|
8199
|
-
if (!found)
|
|
8200
|
-
|
|
8311
|
+
if (!found) {
|
|
8312
|
+
veTrace("dnd", "drag:start-rejected", { nodeId: activeId, reason: "not-scanned" });
|
|
8313
|
+
return;
|
|
8314
|
+
}
|
|
8315
|
+
if (!isEligibleForDrag(found)) {
|
|
8316
|
+
veTrace("dnd", "drag:start-rejected", {
|
|
8317
|
+
nodeId: activeId,
|
|
8318
|
+
reason: "not-eligible",
|
|
8319
|
+
eligibilitySource: found.eligibilitySource ?? "editor-meta",
|
|
8320
|
+
draggable: found.draggable
|
|
8321
|
+
});
|
|
8322
|
+
return;
|
|
8323
|
+
}
|
|
8324
|
+
veTrace("dnd", "drag:start", {
|
|
8325
|
+
nodeId: activeId,
|
|
8326
|
+
eligibilitySource: found.eligibilitySource ?? "editor-meta"
|
|
8327
|
+
});
|
|
8201
8328
|
refs.lastIntentRef.current = null;
|
|
8202
8329
|
refs.visualIntentRef.current = null;
|
|
8203
8330
|
refs.targetPlaneRef.current = "lane";
|
|
@@ -8256,6 +8383,16 @@ function useDragLifecycle({
|
|
|
8256
8383
|
const pointer = refs.mouseRef.current;
|
|
8257
8384
|
const safeZone = refs.safeZoneRef.current;
|
|
8258
8385
|
const blockedByGuard = isPointerOutsideSafeZone(pointer.x, pointer.y, safeZone) || isPointerInHardPageEdgeZone(pointer.x, pointer.y);
|
|
8386
|
+
veTrace("dnd", "drag:end", () => ({
|
|
8387
|
+
selectedNodeId,
|
|
8388
|
+
anchorNodeId,
|
|
8389
|
+
blockedByGuard,
|
|
8390
|
+
intent: refs.visualIntentRef.current ? {
|
|
8391
|
+
mode: refs.visualIntentRef.current.mode,
|
|
8392
|
+
containerId: refs.visualIntentRef.current.containerId,
|
|
8393
|
+
index: refs.visualIntentRef.current.index
|
|
8394
|
+
} : null
|
|
8395
|
+
}));
|
|
8259
8396
|
let sourcePos = refs.dragStartPositionRef.current ?? getCurrentCommitPlacement(anchorNodeId, refs.sourceContainerIdRef.current);
|
|
8260
8397
|
if (!sourcePos && activeEl && activeEl.parentElement) {
|
|
8261
8398
|
const parentEl = activeEl.parentElement;
|
|
@@ -8354,6 +8491,7 @@ function useDragLifecycle({
|
|
|
8354
8491
|
syncHistoryAvailability();
|
|
8355
8492
|
}, [applyCommand, classifyCommandType, clearDragState, getCurrentCommitPlacement, recordMoveChange, resolveNodeElement, selectElement, syncHistoryAvailability]);
|
|
8356
8493
|
const handleDragCancel = (0, import_react13.useCallback)(() => {
|
|
8494
|
+
veTrace("dnd", "drag:cancel");
|
|
8357
8495
|
clearDragState();
|
|
8358
8496
|
}, [clearDragState]);
|
|
8359
8497
|
return { activeDrag, handleDragStart, handleDragEnd, handleDragCancel };
|
|
@@ -8415,6 +8553,17 @@ function useResizeSession({
|
|
|
8415
8553
|
beforeStyles,
|
|
8416
8554
|
hasMoved: false
|
|
8417
8555
|
};
|
|
8556
|
+
veTrace("dnd", "resize:start", {
|
|
8557
|
+
dir,
|
|
8558
|
+
mode,
|
|
8559
|
+
selectedNodeId: nodeId,
|
|
8560
|
+
selectedNodeKey,
|
|
8561
|
+
targetNodeId,
|
|
8562
|
+
targetNodeKey,
|
|
8563
|
+
retargeted: resizeTargetEl !== selectedEl,
|
|
8564
|
+
startW: Math.round(rect.width),
|
|
8565
|
+
startH: Math.round(rect.height)
|
|
8566
|
+
});
|
|
8418
8567
|
pointerTarget?.setPointerCapture?.(e.pointerId);
|
|
8419
8568
|
}, []);
|
|
8420
8569
|
const handleResizePointerMove = (0, import_react14.useCallback)((e) => {
|
|
@@ -8477,6 +8626,7 @@ function useResizeSession({
|
|
|
8477
8626
|
const afterStyles = readStyleSnapshot(element, ["width", "height", "grid-column", "grid-column-end", "grid-row", "grid-row-end"]);
|
|
8478
8627
|
const unchanged = mode === "grid-span" ? afterColSpan === startColSpan && afterRowSpan === startRowSpan : afterW === Math.round(startW) && afterH === Math.round(startH);
|
|
8479
8628
|
if (unchanged) {
|
|
8629
|
+
veTrace("dnd", "resize:noop", { selectedNodeId, targetNodeId });
|
|
8480
8630
|
syncHistoryAvailability();
|
|
8481
8631
|
return;
|
|
8482
8632
|
}
|
|
@@ -8538,6 +8688,10 @@ function useResizeSession({
|
|
|
8538
8688
|
const session = refs.resizeSessionRef.current;
|
|
8539
8689
|
if (!session || session.pointerId !== e.pointerId) return;
|
|
8540
8690
|
if (session.pointerTarget?.hasPointerCapture?.(e.pointerId)) session.pointerTarget.releasePointerCapture(e.pointerId);
|
|
8691
|
+
veTrace("dnd", "resize:cancel", {
|
|
8692
|
+
selectedNodeId: session.selectedNodeId,
|
|
8693
|
+
targetNodeId: session.targetNodeId
|
|
8694
|
+
});
|
|
8541
8695
|
for (const [prop, value] of Object.entries(session.beforeStyles)) {
|
|
8542
8696
|
if (value === null) session.element.style.removeProperty(prop);
|
|
8543
8697
|
else session.element.style.setProperty(prop, value);
|
|
@@ -9328,6 +9482,13 @@ function DndProvider({ children }) {
|
|
|
9328
9482
|
const handleHostCommand = (event) => {
|
|
9329
9483
|
const detail = event.detail;
|
|
9330
9484
|
if (!detail || typeof detail !== "object") return;
|
|
9485
|
+
if (detail.type !== "external-drag-move") {
|
|
9486
|
+
veTrace(
|
|
9487
|
+
"dnd",
|
|
9488
|
+
`host-command:${detail.type}`,
|
|
9489
|
+
() => detail.type === "external-drag-start" ? { displayName: detail.component.displayName, category: detail.component.category } : detail.type === "sync-editor-state" ? { mode: detail.mode ?? null, historyMode: detail.historyMode ?? null } : detail.type === "set-design-mode" ? { enabled: detail.enabled } : void 0
|
|
9490
|
+
);
|
|
9491
|
+
}
|
|
9331
9492
|
switch (detail.type) {
|
|
9332
9493
|
case "sync-editor-state":
|
|
9333
9494
|
if (detail.mode === "design") {
|
package/dist/client/client.mjs
CHANGED
|
@@ -4050,6 +4050,46 @@ function DragOverlay2() {
|
|
|
4050
4050
|
return /* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: renderContent() });
|
|
4051
4051
|
}
|
|
4052
4052
|
|
|
4053
|
+
// src/client/dnd/design-mode/debug-trace.ts
|
|
4054
|
+
var MAX_ENTRIES = 800;
|
|
4055
|
+
function traceWindow() {
|
|
4056
|
+
return typeof window === "undefined" ? null : window;
|
|
4057
|
+
}
|
|
4058
|
+
function isVeDebugEnabled() {
|
|
4059
|
+
const w = traceWindow();
|
|
4060
|
+
if (!w) return false;
|
|
4061
|
+
if (w.__ARCHIE_VE_DEBUG__ === true || w._inspectorDebug === true) return true;
|
|
4062
|
+
try {
|
|
4063
|
+
return w.localStorage?.getItem("ARCHIE_VE_DEBUG") === "1";
|
|
4064
|
+
} catch {
|
|
4065
|
+
return false;
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
function veTrace(layer, event, data) {
|
|
4069
|
+
const w = traceWindow();
|
|
4070
|
+
if (!w) return;
|
|
4071
|
+
let resolved;
|
|
4072
|
+
if (typeof data === "function") {
|
|
4073
|
+
try {
|
|
4074
|
+
resolved = data();
|
|
4075
|
+
} catch (error) {
|
|
4076
|
+
resolved = { __traceDataError: String(error) };
|
|
4077
|
+
}
|
|
4078
|
+
} else {
|
|
4079
|
+
resolved = data;
|
|
4080
|
+
}
|
|
4081
|
+
const entry = { t: Date.now(), layer, event, ...resolved === void 0 ? {} : { data: resolved } };
|
|
4082
|
+
const buffer = w.__ARCHIE_VE_TRACE__ ?? (w.__ARCHIE_VE_TRACE__ = []);
|
|
4083
|
+
buffer.push(entry);
|
|
4084
|
+
if (buffer.length > MAX_ENTRIES) buffer.splice(0, buffer.length - MAX_ENTRIES);
|
|
4085
|
+
if (!w.__ARCHIE_VE_TRACE_DUMP__) {
|
|
4086
|
+
w.__ARCHIE_VE_TRACE_DUMP__ = () => JSON.stringify(w.__ARCHIE_VE_TRACE__ ?? []);
|
|
4087
|
+
}
|
|
4088
|
+
if (isVeDebugEnabled()) {
|
|
4089
|
+
console.log(`[archie-ve:${layer}]`, event, resolved ?? "");
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4053
4093
|
// src/client/dnd/design-mode/host-bridge.ts
|
|
4054
4094
|
var DEFAULT_INSPECTOR_THEME = {
|
|
4055
4095
|
accent: "#8b5cf6",
|
|
@@ -4059,8 +4099,80 @@ var DEFAULT_INSPECTOR_THEME = {
|
|
|
4059
4099
|
};
|
|
4060
4100
|
var HOST_COMMAND_EVENT = "archie:editor-host-command";
|
|
4061
4101
|
var DND_RUNTIME_EVENT = "archie:dnd-runtime-event";
|
|
4102
|
+
function summarizeIdentity(identity2) {
|
|
4103
|
+
if (!identity2) return null;
|
|
4104
|
+
return {
|
|
4105
|
+
nodeId: identity2.nodeId,
|
|
4106
|
+
nodeKey: identity2.nodeKey,
|
|
4107
|
+
ref: identity2.inspectorRef ? `${identity2.inspectorRef.relativePath}:${identity2.inspectorRef.line}:${identity2.inspectorRef.column}` : null,
|
|
4108
|
+
...identity2.effectiveNodeId && identity2.effectiveNodeId !== identity2.nodeId ? { effectiveNodeId: identity2.effectiveNodeId } : {}
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
function summarizeRuntimeEvent(detail) {
|
|
4112
|
+
switch (detail.type) {
|
|
4113
|
+
case "element-moved":
|
|
4114
|
+
return {
|
|
4115
|
+
operationId: detail.operationId,
|
|
4116
|
+
commandType: detail.commandType,
|
|
4117
|
+
selected: summarizeIdentity(detail.selected),
|
|
4118
|
+
anchor: summarizeIdentity(detail.anchor),
|
|
4119
|
+
container: summarizeIdentity(detail.container),
|
|
4120
|
+
beforeSibling: summarizeIdentity(detail.beforeSibling),
|
|
4121
|
+
sourceContainer: summarizeIdentity(detail.sourceContainer),
|
|
4122
|
+
diagnostics: detail.diagnostics ?? null
|
|
4123
|
+
};
|
|
4124
|
+
case "element-resized":
|
|
4125
|
+
return {
|
|
4126
|
+
operationId: detail.operationId,
|
|
4127
|
+
selected: summarizeIdentity(detail.selected),
|
|
4128
|
+
anchor: summarizeIdentity(detail.anchor),
|
|
4129
|
+
resize: {
|
|
4130
|
+
mode: detail.resize.mode,
|
|
4131
|
+
selectedNodeKey: detail.resize.selectedNodeKey,
|
|
4132
|
+
targetNodeKey: detail.resize.targetNodeKey,
|
|
4133
|
+
targetNodeId: detail.resize.targetNodeId,
|
|
4134
|
+
width: detail.resize.width,
|
|
4135
|
+
height: detail.resize.height
|
|
4136
|
+
}
|
|
4137
|
+
};
|
|
4138
|
+
case "element-inserted":
|
|
4139
|
+
return {
|
|
4140
|
+
operationId: detail.operationId,
|
|
4141
|
+
nodeId: detail.nodeId,
|
|
4142
|
+
nodeKey: detail.nodeKey,
|
|
4143
|
+
displayName: detail.displayName,
|
|
4144
|
+
container: summarizeIdentity(detail.container),
|
|
4145
|
+
index: detail.index,
|
|
4146
|
+
beforeSibling: summarizeIdentity(detail.beforeSibling),
|
|
4147
|
+
hasTsxCode: !!detail.tsxCode,
|
|
4148
|
+
htmlLength: detail.html?.length ?? 0
|
|
4149
|
+
};
|
|
4150
|
+
case "arrange-session-changed":
|
|
4151
|
+
return {
|
|
4152
|
+
mode: detail.session.mode,
|
|
4153
|
+
canUndo: detail.session.canUndo,
|
|
4154
|
+
changeCount: detail.session.changes.length,
|
|
4155
|
+
changes: detail.session.changes.map((c) => ({
|
|
4156
|
+
id: c.id,
|
|
4157
|
+
kind: c.kind,
|
|
4158
|
+
operationId: c.operationId,
|
|
4159
|
+
nodeKey: c.nodeKey,
|
|
4160
|
+
ref: c.inspectorRef ? `${c.inspectorRef.relativePath}:${c.inspectorRef.line}:${c.inspectorRef.column}` : null
|
|
4161
|
+
}))
|
|
4162
|
+
};
|
|
4163
|
+
case "arrange-undo-applied":
|
|
4164
|
+
return { success: detail.success, updatedAt: detail.updatedAt };
|
|
4165
|
+
case "design-mode-changed":
|
|
4166
|
+
return { mode: detail.mode };
|
|
4167
|
+
case "design-mode-error":
|
|
4168
|
+
return { error: detail.error };
|
|
4169
|
+
default:
|
|
4170
|
+
return null;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4062
4173
|
function dispatchRuntimeEvent(detail) {
|
|
4063
4174
|
if (typeof window === "undefined") return;
|
|
4175
|
+
veTrace("dnd", `runtime-event:${detail.type}`, () => summarizeRuntimeEvent(detail));
|
|
4064
4176
|
window.dispatchEvent(new CustomEvent(DND_RUNTIME_EVENT, { detail }));
|
|
4065
4177
|
}
|
|
4066
4178
|
function resolveRowBinding(el) {
|
|
@@ -8161,8 +8273,23 @@ function useDragLifecycle({
|
|
|
8161
8273
|
if (refs.resizeSessionRef.current || Date.now() < refs.resizeDragBlockUntilRef.current) return;
|
|
8162
8274
|
const activeId = active.id;
|
|
8163
8275
|
const found = refs.draggableNodeMapRef.current.get(activeId) ?? refs.nodeMapRef.current.get(activeId);
|
|
8164
|
-
if (!found)
|
|
8165
|
-
|
|
8276
|
+
if (!found) {
|
|
8277
|
+
veTrace("dnd", "drag:start-rejected", { nodeId: activeId, reason: "not-scanned" });
|
|
8278
|
+
return;
|
|
8279
|
+
}
|
|
8280
|
+
if (!isEligibleForDrag(found)) {
|
|
8281
|
+
veTrace("dnd", "drag:start-rejected", {
|
|
8282
|
+
nodeId: activeId,
|
|
8283
|
+
reason: "not-eligible",
|
|
8284
|
+
eligibilitySource: found.eligibilitySource ?? "editor-meta",
|
|
8285
|
+
draggable: found.draggable
|
|
8286
|
+
});
|
|
8287
|
+
return;
|
|
8288
|
+
}
|
|
8289
|
+
veTrace("dnd", "drag:start", {
|
|
8290
|
+
nodeId: activeId,
|
|
8291
|
+
eligibilitySource: found.eligibilitySource ?? "editor-meta"
|
|
8292
|
+
});
|
|
8166
8293
|
refs.lastIntentRef.current = null;
|
|
8167
8294
|
refs.visualIntentRef.current = null;
|
|
8168
8295
|
refs.targetPlaneRef.current = "lane";
|
|
@@ -8221,6 +8348,16 @@ function useDragLifecycle({
|
|
|
8221
8348
|
const pointer = refs.mouseRef.current;
|
|
8222
8349
|
const safeZone = refs.safeZoneRef.current;
|
|
8223
8350
|
const blockedByGuard = isPointerOutsideSafeZone(pointer.x, pointer.y, safeZone) || isPointerInHardPageEdgeZone(pointer.x, pointer.y);
|
|
8351
|
+
veTrace("dnd", "drag:end", () => ({
|
|
8352
|
+
selectedNodeId,
|
|
8353
|
+
anchorNodeId,
|
|
8354
|
+
blockedByGuard,
|
|
8355
|
+
intent: refs.visualIntentRef.current ? {
|
|
8356
|
+
mode: refs.visualIntentRef.current.mode,
|
|
8357
|
+
containerId: refs.visualIntentRef.current.containerId,
|
|
8358
|
+
index: refs.visualIntentRef.current.index
|
|
8359
|
+
} : null
|
|
8360
|
+
}));
|
|
8224
8361
|
let sourcePos = refs.dragStartPositionRef.current ?? getCurrentCommitPlacement(anchorNodeId, refs.sourceContainerIdRef.current);
|
|
8225
8362
|
if (!sourcePos && activeEl && activeEl.parentElement) {
|
|
8226
8363
|
const parentEl = activeEl.parentElement;
|
|
@@ -8319,6 +8456,7 @@ function useDragLifecycle({
|
|
|
8319
8456
|
syncHistoryAvailability();
|
|
8320
8457
|
}, [applyCommand, classifyCommandType, clearDragState, getCurrentCommitPlacement, recordMoveChange, resolveNodeElement, selectElement, syncHistoryAvailability]);
|
|
8321
8458
|
const handleDragCancel = useCallback6(() => {
|
|
8459
|
+
veTrace("dnd", "drag:cancel");
|
|
8322
8460
|
clearDragState();
|
|
8323
8461
|
}, [clearDragState]);
|
|
8324
8462
|
return { activeDrag, handleDragStart, handleDragEnd, handleDragCancel };
|
|
@@ -8380,6 +8518,17 @@ function useResizeSession({
|
|
|
8380
8518
|
beforeStyles,
|
|
8381
8519
|
hasMoved: false
|
|
8382
8520
|
};
|
|
8521
|
+
veTrace("dnd", "resize:start", {
|
|
8522
|
+
dir,
|
|
8523
|
+
mode,
|
|
8524
|
+
selectedNodeId: nodeId,
|
|
8525
|
+
selectedNodeKey,
|
|
8526
|
+
targetNodeId,
|
|
8527
|
+
targetNodeKey,
|
|
8528
|
+
retargeted: resizeTargetEl !== selectedEl,
|
|
8529
|
+
startW: Math.round(rect.width),
|
|
8530
|
+
startH: Math.round(rect.height)
|
|
8531
|
+
});
|
|
8383
8532
|
pointerTarget?.setPointerCapture?.(e.pointerId);
|
|
8384
8533
|
}, []);
|
|
8385
8534
|
const handleResizePointerMove = useCallback7((e) => {
|
|
@@ -8442,6 +8591,7 @@ function useResizeSession({
|
|
|
8442
8591
|
const afterStyles = readStyleSnapshot(element, ["width", "height", "grid-column", "grid-column-end", "grid-row", "grid-row-end"]);
|
|
8443
8592
|
const unchanged = mode === "grid-span" ? afterColSpan === startColSpan && afterRowSpan === startRowSpan : afterW === Math.round(startW) && afterH === Math.round(startH);
|
|
8444
8593
|
if (unchanged) {
|
|
8594
|
+
veTrace("dnd", "resize:noop", { selectedNodeId, targetNodeId });
|
|
8445
8595
|
syncHistoryAvailability();
|
|
8446
8596
|
return;
|
|
8447
8597
|
}
|
|
@@ -8503,6 +8653,10 @@ function useResizeSession({
|
|
|
8503
8653
|
const session = refs.resizeSessionRef.current;
|
|
8504
8654
|
if (!session || session.pointerId !== e.pointerId) return;
|
|
8505
8655
|
if (session.pointerTarget?.hasPointerCapture?.(e.pointerId)) session.pointerTarget.releasePointerCapture(e.pointerId);
|
|
8656
|
+
veTrace("dnd", "resize:cancel", {
|
|
8657
|
+
selectedNodeId: session.selectedNodeId,
|
|
8658
|
+
targetNodeId: session.targetNodeId
|
|
8659
|
+
});
|
|
8506
8660
|
for (const [prop, value] of Object.entries(session.beforeStyles)) {
|
|
8507
8661
|
if (value === null) session.element.style.removeProperty(prop);
|
|
8508
8662
|
else session.element.style.setProperty(prop, value);
|
|
@@ -9293,6 +9447,13 @@ function DndProvider({ children }) {
|
|
|
9293
9447
|
const handleHostCommand = (event) => {
|
|
9294
9448
|
const detail = event.detail;
|
|
9295
9449
|
if (!detail || typeof detail !== "object") return;
|
|
9450
|
+
if (detail.type !== "external-drag-move") {
|
|
9451
|
+
veTrace(
|
|
9452
|
+
"dnd",
|
|
9453
|
+
`host-command:${detail.type}`,
|
|
9454
|
+
() => detail.type === "external-drag-start" ? { displayName: detail.component.displayName, category: detail.component.category } : detail.type === "sync-editor-state" ? { mode: detail.mode ?? null, historyMode: detail.historyMode ?? null } : detail.type === "set-design-mode" ? { enabled: detail.enabled } : void 0
|
|
9455
|
+
);
|
|
9456
|
+
}
|
|
9296
9457
|
switch (detail.type) {
|
|
9297
9458
|
case "sync-editor-state":
|
|
9298
9459
|
if (detail.mode === "design") {
|