@archie/devtools 0.0.43 → 0.0.44
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 +19 -11
- package/dist/client/client.mjs +19 -11
- package/package.json +1 -1
package/dist/client/client.js
CHANGED
|
@@ -5259,8 +5259,10 @@ function ensureUniqueNodeId(base, used) {
|
|
|
5259
5259
|
while (used.has(`${base}::${idx}`)) idx += 1;
|
|
5260
5260
|
return `${base}::${idx}`;
|
|
5261
5261
|
}
|
|
5262
|
+
var INSERT_NODE_ID_PREFIX = "insert:";
|
|
5262
5263
|
function resolveStableNodeId(el, used) {
|
|
5263
5264
|
const persisted = el.getAttribute(DND_NODE_ID_ATTR);
|
|
5265
|
+
if (persisted && persisted.startsWith(INSERT_NODE_ID_PREFIX)) return persisted;
|
|
5264
5266
|
if (persisted && !used.has(persisted)) return persisted;
|
|
5265
5267
|
const projected = projectUsageMeta(el);
|
|
5266
5268
|
if (projected) return ensureUniqueNodeId(projected.nodeId, used);
|
|
@@ -5331,7 +5333,7 @@ function isFlexOrGridParent(el) {
|
|
|
5331
5333
|
const d = getComputedStyle(el).display;
|
|
5332
5334
|
return d === "flex" || d === "grid" || d === "inline-flex" || d === "inline-grid";
|
|
5333
5335
|
}
|
|
5334
|
-
function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(), seenResolvedHosts = /* @__PURE__ */ new WeakSet()) {
|
|
5336
|
+
function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(), seenResolvedHosts = /* @__PURE__ */ new WeakSet(), resolvedUnreported = /* @__PURE__ */ new Set()) {
|
|
5335
5337
|
if (depth > MAX_DEPTH) return [];
|
|
5336
5338
|
const results = [];
|
|
5337
5339
|
for (const child of Array.from(root.children)) {
|
|
@@ -5356,7 +5358,9 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5356
5358
|
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
5357
5359
|
usedNodeIds.add(nodeId2);
|
|
5358
5360
|
el.setAttribute(DND_NODE_ID_ATTR, nodeId2);
|
|
5359
|
-
if (
|
|
5361
|
+
if (isZeroRect) {
|
|
5362
|
+
resolvedUnreported.add(el);
|
|
5363
|
+
} else {
|
|
5360
5364
|
seenResolvedHosts.add(el);
|
|
5361
5365
|
const surfaceMeta2 = el instanceof HTMLElement ? getDirectEditorMeta(el) ?? void 0 : void 0;
|
|
5362
5366
|
const identityMeta3 = projectUsageMeta(el) ?? surfaceMeta2;
|
|
@@ -5380,7 +5384,7 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5380
5384
|
});
|
|
5381
5385
|
}
|
|
5382
5386
|
}
|
|
5383
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5387
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5384
5388
|
continue;
|
|
5385
5389
|
}
|
|
5386
5390
|
if (isSvgRoot && isInspectorEligible(el) === null) {
|
|
@@ -5389,7 +5393,7 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5389
5393
|
const eligibilitySource = isInspectorEligible(el);
|
|
5390
5394
|
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el) ?? (projectUsageMeta(el) ? "projected-usage" : null);
|
|
5391
5395
|
if (inferredEligibility === null) {
|
|
5392
|
-
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts);
|
|
5396
|
+
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported);
|
|
5393
5397
|
results.push(...childResults);
|
|
5394
5398
|
if (isFlexOrGridParent(el) && !seenResolvedHosts.has(el) && childResults.some((r) => r.draggable && r.element.parentElement === el)) {
|
|
5395
5399
|
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
@@ -5417,13 +5421,13 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5417
5421
|
const dragSurface = resolveDragSurface(el);
|
|
5418
5422
|
const hostEl = dragSurface.host;
|
|
5419
5423
|
if (!hostEl) {
|
|
5420
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5424
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5421
5425
|
continue;
|
|
5422
5426
|
}
|
|
5423
5427
|
const hostRect = hostEl.getBoundingClientRect();
|
|
5424
5428
|
const nodeId = resolveStableNodeId(hostEl, usedNodeIds);
|
|
5425
5429
|
if (seenResolvedHosts.has(hostEl)) {
|
|
5426
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5430
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5427
5431
|
continue;
|
|
5428
5432
|
}
|
|
5429
5433
|
seenResolvedHosts.add(hostEl);
|
|
@@ -5453,9 +5457,9 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5453
5457
|
identityOrigin: templateFrameLabel(identityMeta2),
|
|
5454
5458
|
editorMeta: surfaceMeta
|
|
5455
5459
|
});
|
|
5456
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5460
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5457
5461
|
} else {
|
|
5458
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5462
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5459
5463
|
}
|
|
5460
5464
|
}
|
|
5461
5465
|
return results;
|
|
@@ -5511,8 +5515,10 @@ function useElementScanner(enabled) {
|
|
|
5511
5515
|
if (pausedRef.current) return;
|
|
5512
5516
|
const root = document.getElementById("root") ?? document.body;
|
|
5513
5517
|
const usedNodeIds = /* @__PURE__ */ new Set();
|
|
5514
|
-
const
|
|
5518
|
+
const resolvedUnreported = /* @__PURE__ */ new Set();
|
|
5519
|
+
const scanned = scanElements(root, 0, usedNodeIds, void 0, resolvedUnreported);
|
|
5515
5520
|
const seenEls = new Set(scanned.map((s) => s.element));
|
|
5521
|
+
for (const el of resolvedUnreported) seenEls.add(el);
|
|
5516
5522
|
for (const el of Array.from(document.querySelectorAll("[data-dnd-moved]"))) {
|
|
5517
5523
|
if (seenEls.has(el)) continue;
|
|
5518
5524
|
const entry = buildMovedElementEntry(el, usedNodeIds);
|
|
@@ -5752,7 +5758,7 @@ function ElementHighlight({
|
|
|
5752
5758
|
"data-outline-for": el.nodeId,
|
|
5753
5759
|
"data-design-mode-ui": true,
|
|
5754
5760
|
style: getOutlineStyle(rect, isSelected, inspectorTheme),
|
|
5755
|
-
children: isSelected && HANDLES.map((dir) => {
|
|
5761
|
+
children: isSelected && el.draggable && HANDLES.map((dir) => {
|
|
5756
5762
|
const pos = handlePosition(dir);
|
|
5757
5763
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5758
5764
|
"div",
|
|
@@ -8519,7 +8525,9 @@ function useResizeSession({
|
|
|
8519
8525
|
}) {
|
|
8520
8526
|
const handleResizeHandlePointerDown = (0, import_react14.useCallback)((e, nodeId, dir) => {
|
|
8521
8527
|
if (refs.resizeSessionRef.current) return;
|
|
8522
|
-
const
|
|
8528
|
+
const scanned = refs.nodeMapRef.current.get(nodeId);
|
|
8529
|
+
if (scanned && scanned.draggable === false) return;
|
|
8530
|
+
const selectedEl = scanned?.element ?? document.querySelector(`[data-dnd-node-id="${nodeId}"]`);
|
|
8523
8531
|
if (!selectedEl) return;
|
|
8524
8532
|
e.preventDefault();
|
|
8525
8533
|
e.stopPropagation();
|
package/dist/client/client.mjs
CHANGED
|
@@ -5224,8 +5224,10 @@ function ensureUniqueNodeId(base, used) {
|
|
|
5224
5224
|
while (used.has(`${base}::${idx}`)) idx += 1;
|
|
5225
5225
|
return `${base}::${idx}`;
|
|
5226
5226
|
}
|
|
5227
|
+
var INSERT_NODE_ID_PREFIX = "insert:";
|
|
5227
5228
|
function resolveStableNodeId(el, used) {
|
|
5228
5229
|
const persisted = el.getAttribute(DND_NODE_ID_ATTR);
|
|
5230
|
+
if (persisted && persisted.startsWith(INSERT_NODE_ID_PREFIX)) return persisted;
|
|
5229
5231
|
if (persisted && !used.has(persisted)) return persisted;
|
|
5230
5232
|
const projected = projectUsageMeta(el);
|
|
5231
5233
|
if (projected) return ensureUniqueNodeId(projected.nodeId, used);
|
|
@@ -5296,7 +5298,7 @@ function isFlexOrGridParent(el) {
|
|
|
5296
5298
|
const d = getComputedStyle(el).display;
|
|
5297
5299
|
return d === "flex" || d === "grid" || d === "inline-flex" || d === "inline-grid";
|
|
5298
5300
|
}
|
|
5299
|
-
function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(), seenResolvedHosts = /* @__PURE__ */ new WeakSet()) {
|
|
5301
|
+
function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(), seenResolvedHosts = /* @__PURE__ */ new WeakSet(), resolvedUnreported = /* @__PURE__ */ new Set()) {
|
|
5300
5302
|
if (depth > MAX_DEPTH) return [];
|
|
5301
5303
|
const results = [];
|
|
5302
5304
|
for (const child of Array.from(root.children)) {
|
|
@@ -5321,7 +5323,9 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5321
5323
|
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
5322
5324
|
usedNodeIds.add(nodeId2);
|
|
5323
5325
|
el.setAttribute(DND_NODE_ID_ATTR, nodeId2);
|
|
5324
|
-
if (
|
|
5326
|
+
if (isZeroRect) {
|
|
5327
|
+
resolvedUnreported.add(el);
|
|
5328
|
+
} else {
|
|
5325
5329
|
seenResolvedHosts.add(el);
|
|
5326
5330
|
const surfaceMeta2 = el instanceof HTMLElement ? getDirectEditorMeta(el) ?? void 0 : void 0;
|
|
5327
5331
|
const identityMeta3 = projectUsageMeta(el) ?? surfaceMeta2;
|
|
@@ -5345,7 +5349,7 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5345
5349
|
});
|
|
5346
5350
|
}
|
|
5347
5351
|
}
|
|
5348
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5352
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5349
5353
|
continue;
|
|
5350
5354
|
}
|
|
5351
5355
|
if (isSvgRoot && isInspectorEligible(el) === null) {
|
|
@@ -5354,7 +5358,7 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5354
5358
|
const eligibilitySource = isInspectorEligible(el);
|
|
5355
5359
|
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el) ?? (projectUsageMeta(el) ? "projected-usage" : null);
|
|
5356
5360
|
if (inferredEligibility === null) {
|
|
5357
|
-
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts);
|
|
5361
|
+
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported);
|
|
5358
5362
|
results.push(...childResults);
|
|
5359
5363
|
if (isFlexOrGridParent(el) && !seenResolvedHosts.has(el) && childResults.some((r) => r.draggable && r.element.parentElement === el)) {
|
|
5360
5364
|
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
@@ -5382,13 +5386,13 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5382
5386
|
const dragSurface = resolveDragSurface(el);
|
|
5383
5387
|
const hostEl = dragSurface.host;
|
|
5384
5388
|
if (!hostEl) {
|
|
5385
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5389
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5386
5390
|
continue;
|
|
5387
5391
|
}
|
|
5388
5392
|
const hostRect = hostEl.getBoundingClientRect();
|
|
5389
5393
|
const nodeId = resolveStableNodeId(hostEl, usedNodeIds);
|
|
5390
5394
|
if (seenResolvedHosts.has(hostEl)) {
|
|
5391
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5395
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5392
5396
|
continue;
|
|
5393
5397
|
}
|
|
5394
5398
|
seenResolvedHosts.add(hostEl);
|
|
@@ -5418,9 +5422,9 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5418
5422
|
identityOrigin: templateFrameLabel(identityMeta2),
|
|
5419
5423
|
editorMeta: surfaceMeta
|
|
5420
5424
|
});
|
|
5421
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5425
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5422
5426
|
} else {
|
|
5423
|
-
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts));
|
|
5427
|
+
if (!isSvgRoot) results.push(...scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts, resolvedUnreported));
|
|
5424
5428
|
}
|
|
5425
5429
|
}
|
|
5426
5430
|
return results;
|
|
@@ -5476,8 +5480,10 @@ function useElementScanner(enabled) {
|
|
|
5476
5480
|
if (pausedRef.current) return;
|
|
5477
5481
|
const root = document.getElementById("root") ?? document.body;
|
|
5478
5482
|
const usedNodeIds = /* @__PURE__ */ new Set();
|
|
5479
|
-
const
|
|
5483
|
+
const resolvedUnreported = /* @__PURE__ */ new Set();
|
|
5484
|
+
const scanned = scanElements(root, 0, usedNodeIds, void 0, resolvedUnreported);
|
|
5480
5485
|
const seenEls = new Set(scanned.map((s) => s.element));
|
|
5486
|
+
for (const el of resolvedUnreported) seenEls.add(el);
|
|
5481
5487
|
for (const el of Array.from(document.querySelectorAll("[data-dnd-moved]"))) {
|
|
5482
5488
|
if (seenEls.has(el)) continue;
|
|
5483
5489
|
const entry = buildMovedElementEntry(el, usedNodeIds);
|
|
@@ -5717,7 +5723,7 @@ function ElementHighlight({
|
|
|
5717
5723
|
"data-outline-for": el.nodeId,
|
|
5718
5724
|
"data-design-mode-ui": true,
|
|
5719
5725
|
style: getOutlineStyle(rect, isSelected, inspectorTheme),
|
|
5720
|
-
children: isSelected && HANDLES.map((dir) => {
|
|
5726
|
+
children: isSelected && el.draggable && HANDLES.map((dir) => {
|
|
5721
5727
|
const pos = handlePosition(dir);
|
|
5722
5728
|
return /* @__PURE__ */ jsx2(
|
|
5723
5729
|
"div",
|
|
@@ -8484,7 +8490,9 @@ function useResizeSession({
|
|
|
8484
8490
|
}) {
|
|
8485
8491
|
const handleResizeHandlePointerDown = useCallback7((e, nodeId, dir) => {
|
|
8486
8492
|
if (refs.resizeSessionRef.current) return;
|
|
8487
|
-
const
|
|
8493
|
+
const scanned = refs.nodeMapRef.current.get(nodeId);
|
|
8494
|
+
if (scanned && scanned.draggable === false) return;
|
|
8495
|
+
const selectedEl = scanned?.element ?? document.querySelector(`[data-dnd-node-id="${nodeId}"]`);
|
|
8488
8496
|
if (!selectedEl) return;
|
|
8489
8497
|
e.preventDefault();
|
|
8490
8498
|
e.stopPropagation();
|