@archie/devtools 0.0.24 → 0.0.25
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/inspector.standalone.js +36 -0
- package/package.json +1 -1
|
@@ -424,6 +424,35 @@
|
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
// ARCH-906 — the DURABLE `data-agent-id` anchors on the ANCESTOR chain,
|
|
428
|
+
// innermost first. This is a DOM-attribute walk, not a fiber walk (no twin
|
|
429
|
+
// in fiber-bridge.ts to mirror): it reads the semantic anchors the render
|
|
430
|
+
// stamps (`row:<id>`, `data:<Entity>`, `screen:<slug>`, `job:<id>`) and
|
|
431
|
+
// forwards them so the host can resolve a slice DATA cell.
|
|
432
|
+
//
|
|
433
|
+
// WHY THE ANCESTOR CHAIN, and why it is not `editorInstance`. Clicking a
|
|
434
|
+
// table cell resolves the INNERMOST collection — the `<td key={c.key}>` map
|
|
435
|
+
// — so `editorInstance.fiberKey` already carries the FIELD. The ROW it
|
|
436
|
+
// belongs to lives one level up on `<tr data-agent-id="row:<id>">`, and the
|
|
437
|
+
// ENTITY on a container above that (`data-agent-id="data:<Entity>"`).
|
|
438
|
+
// Neither can be the innermost collection key, so the host cannot recover
|
|
439
|
+
// them from `editorInstance` — it needs the ancestor anchors verbatim.
|
|
440
|
+
// Strict ancestors only (the selected node's own anchor is already in
|
|
441
|
+
// `attributes`); the host picks the nearest `row:`/`data:` by namespace.
|
|
442
|
+
var MAX_ANCHOR_CHAIN = 24
|
|
443
|
+
function collectAncestorAnchors(el) {
|
|
444
|
+
var anchors = []
|
|
445
|
+
var node = el && el.parentElement ? el.parentElement : null
|
|
446
|
+
for (var depth = 0; node && depth < MAX_ANCHOR_CHAIN; depth++) {
|
|
447
|
+
if (node.nodeType === 1 && typeof node.getAttribute === "function") {
|
|
448
|
+
var id = node.getAttribute("data-agent-id")
|
|
449
|
+
if (typeof id === "string" && id !== "") anchors.push(id)
|
|
450
|
+
}
|
|
451
|
+
node = node.parentElement
|
|
452
|
+
}
|
|
453
|
+
return anchors
|
|
454
|
+
}
|
|
455
|
+
|
|
427
456
|
if (window._inspectorSharedTargetObserver) {
|
|
428
457
|
try {
|
|
429
458
|
window._inspectorSharedTargetObserver.disconnect()
|
|
@@ -2240,6 +2269,13 @@
|
|
|
2240
2269
|
editorMeta ? editorMeta.element : element
|
|
2241
2270
|
),
|
|
2242
2271
|
editorInstance: resolveInstanceIdentity(element),
|
|
2272
|
+
// ARCH-906 — the ancestor `data-agent-id` chain (innermost first). A
|
|
2273
|
+
// slice DATA cell needs the ROW id (`row:<id>` on the `<tr>`) and the
|
|
2274
|
+
// ENTITY (`data:<Entity>` above it), neither of which is the innermost
|
|
2275
|
+
// collection key `editorInstance` carries. Plain string data, so an
|
|
2276
|
+
// already-published copy of this script forwards it unchanged through
|
|
2277
|
+
// structured clone; a host that does not read it is unaffected.
|
|
2278
|
+
ancestorAnchors: collectAncestorAnchors(element),
|
|
2243
2279
|
computedStyles: {
|
|
2244
2280
|
display: computed.display,
|
|
2245
2281
|
position: computed.position,
|