@archie/devtools 0.0.34 → 0.0.35

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.
@@ -6088,6 +6088,8 @@ function resolveResizeTargetElement(selectedEl) {
6088
6088
  );
6089
6089
  if (elementChildren.length !== 1) return selectedEl;
6090
6090
  const child = elementChildren[0];
6091
+ const childId = child.getAttribute(DND_NODE_ID_ATTR);
6092
+ if (childId && !childId.startsWith("dnd-parent:")) return selectedEl;
6091
6093
  const ownText = Array.from(selectedEl.childNodes).some((node) => {
6092
6094
  if (node.nodeType !== Node.TEXT_NODE) return false;
6093
6095
  return (node.textContent ?? "").trim().length > 0;
@@ -6053,6 +6053,8 @@ function resolveResizeTargetElement(selectedEl) {
6053
6053
  );
6054
6054
  if (elementChildren.length !== 1) return selectedEl;
6055
6055
  const child = elementChildren[0];
6056
+ const childId = child.getAttribute(DND_NODE_ID_ATTR);
6057
+ if (childId && !childId.startsWith("dnd-parent:")) return selectedEl;
6056
6058
  const ownText = Array.from(selectedEl.childNodes).some((node) => {
6057
6059
  if (node.nodeType !== Node.TEXT_NODE) return false;
6058
6060
  return (node.textContent ?? "").trim().length > 0;
@@ -796,6 +796,29 @@
796
796
  }
797
797
  var ARCHIE_SOURCE_REF_ATTR = "data-archie-source-ref"
798
798
 
799
+ /**
800
+ * True for any element inside a palette-inserted, not-yet-saved subtree.
801
+ * The host stamps `data-archie-inserted` on every element of the palette
802
+ * HTML; the `insert:` nodeId covers roots dropped before the stamping
803
+ * existed. These nodes have NO source of their own, so every ancestor-
804
+ * walking fallback (nearest meta, legacy component root) would attribute
805
+ * them to a DIFFERENT node's source — grouping the whole inserted
806
+ * subtree (and its host component) into one shared-edit signature, which
807
+ * is how painting one inserted div flooded the AppShell main and every
808
+ * sibling insert.
809
+ */
810
+ function isInsertedSubtreeElement(element) {
811
+ if (!element || typeof element.closest !== "function") return false
812
+ try {
813
+ return !!(
814
+ element.closest("[data-archie-inserted]") ||
815
+ element.closest('[data-dnd-node-id^="insert:"]')
816
+ )
817
+ } catch (e) {
818
+ return false
819
+ }
820
+ }
821
+
799
822
  function normalizeSharedSignaturePart(value) {
800
823
  if (value == null) return ""
801
824
  return String(value).trim()
@@ -815,6 +838,9 @@
815
838
 
816
839
  function getLegacySharedSignatureFromElement(element) {
817
840
  if (!element || typeof element.closest !== "function") return ""
841
+ // An inserted node's closest component root is its DROP TARGET, not
842
+ // its own source — sharing that signature floods the host component.
843
+ if (isInsertedSubtreeElement(element)) return ""
818
844
  var componentRoot = element.closest("[data-inspector-relative-path]")
819
845
  if (!componentRoot) return ""
820
846
 
@@ -875,6 +901,11 @@
875
901
  function getCoarseSharedSignatureFromElement(element) {
876
902
  if (!element) return ""
877
903
 
904
+ // Nearest-meta is an ANCESTOR walk; for an inserted node it lands on
905
+ // the drop container's meta (e.g. AppShell main), which is not this
906
+ // node's identity. No signature ⇒ no shared grouping.
907
+ if (isInsertedSubtreeElement(element)) return ""
908
+
878
909
  var nearestMeta = findNearestEditorMeta(element)
879
910
  var nearestSignature =
880
911
  nearestMeta && nearestMeta.meta
@@ -1177,6 +1208,13 @@
1177
1208
  return buildInspectorInfoFromExactSignature(exactSignature, element)
1178
1209
  }
1179
1210
 
1211
+ // Everything below walks ANCESTORS. A palette-inserted node has no
1212
+ // source until its insert is saved; reporting the drop container's
1213
+ // source as its own is what routed edits to the AppShell main.
1214
+ if (isInsertedSubtreeElement(element)) {
1215
+ return null
1216
+ }
1217
+
1180
1218
  var metaResult = findNearestEditorMeta(element)
1181
1219
  if (metaResult && metaResult.meta) {
1182
1220
  return buildInspectorInfoFromMeta(metaResult.meta)
@@ -1214,6 +1252,15 @@
1214
1252
  var inspectTarget = resolveExactInspectTarget(referenceElement)
1215
1253
  if (!inspectTarget) return []
1216
1254
 
1255
+ // A palette-inserted node is a one-off DOM instance: it shares source
1256
+ // with nothing, so an edit on it must never fan out. (Choke point for
1257
+ // every APPLY_* handler's shared spread — the signature guards above
1258
+ // make this redundant for new indexes, but an already-built index may
1259
+ // still hold a stale group.)
1260
+ if (isInsertedSubtreeElement(inspectTarget)) {
1261
+ return [inspectTarget]
1262
+ }
1263
+
1217
1264
  var signature = resolveSharedGroupSignature(inspectTarget)
1218
1265
  if (signature) {
1219
1266
  rebuildSharedTargetIndex()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "repository": {
6
6
  "type": "git",