@archie/devtools 0.0.19 → 0.0.20

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.
@@ -4927,6 +4927,16 @@ function buildNodeSelector(nodeId) {
4927
4927
  var LARGE_NODE_NEST_BLOCK_MIN_WIDTH = 520;
4928
4928
  var LARGE_NODE_NEST_BLOCK_MIN_HEIGHT = 260;
4929
4929
  var LARGE_NODE_NEST_BLOCK_MIN_AREA = 18e4;
4930
+ function resolveGrabFeedbackTarget(target, scannedByNodeId) {
4931
+ if (!(target instanceof Element)) return null;
4932
+ if (target.closest("[data-design-mode-ui]")) return null;
4933
+ const host = target.closest(`[${DND_NODE_ID_ATTR}]`);
4934
+ if (!host) return null;
4935
+ const nodeId = host.getAttribute(DND_NODE_ID_ATTR);
4936
+ const scanned = nodeId ? scannedByNodeId.get(nodeId) : null;
4937
+ if (!scanned || scanned.draggable !== false) return null;
4938
+ return scanned;
4939
+ }
4930
4940
  function isEligibleForDrag(sc) {
4931
4941
  if (sc.draggable === false) return false;
4932
4942
  const source = sc.eligibilitySource ?? "editor-meta";
@@ -8736,6 +8746,25 @@ function DesignModeOverlay() {
8736
8746
  for (const el of draggableElements) m.set(el.nodeId, el);
8737
8747
  refs.draggableNodeMapRef.current = m;
8738
8748
  }, [draggableElements]);
8749
+ const [grabFeedback, setGrabFeedback] = (0, import_react17.useState)(null);
8750
+ (0, import_react17.useEffect)(() => {
8751
+ if (!enabled) return;
8752
+ const onPointerDown = (e) => {
8753
+ const scanned = resolveGrabFeedbackTarget(
8754
+ e.target,
8755
+ refs.nodeMapRef.current
8756
+ );
8757
+ if (!scanned) return;
8758
+ setGrabFeedback({ x: e.clientX, y: e.clientY, at: Date.now() });
8759
+ };
8760
+ document.addEventListener("pointerdown", onPointerDown, true);
8761
+ return () => document.removeEventListener("pointerdown", onPointerDown, true);
8762
+ }, [enabled]);
8763
+ (0, import_react17.useEffect)(() => {
8764
+ if (!grabFeedback) return;
8765
+ const t = setTimeout(() => setGrabFeedback(null), 1400);
8766
+ return () => clearTimeout(t);
8767
+ }, [grabFeedback]);
8739
8768
  const resolveNodeElement = (0, import_react17.useCallback)((nodeId) => {
8740
8769
  const known = refs.nodeMapRef.current.get(nodeId)?.element;
8741
8770
  if (known) return known;
@@ -8947,6 +8976,29 @@ function DesignModeOverlay() {
8947
8976
  },
8948
8977
  el.nodeId
8949
8978
  )),
8979
+ grabFeedback ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
8980
+ "div",
8981
+ {
8982
+ "data-design-mode-ui": "true",
8983
+ style: {
8984
+ position: "fixed",
8985
+ left: grabFeedback.x,
8986
+ top: grabFeedback.y - 34,
8987
+ transform: "translateX(-50%)",
8988
+ zIndex: 2147483646,
8989
+ pointerEvents: "none",
8990
+ background: "rgba(23, 23, 23, 0.92)",
8991
+ color: "#fff",
8992
+ font: "500 11px/1.4 system-ui, sans-serif",
8993
+ padding: "4px 8px",
8994
+ borderRadius: 6,
8995
+ whiteSpace: "nowrap",
8996
+ boxShadow: "0 2px 8px rgba(0,0,0,0.25)"
8997
+ },
8998
+ children: "This element can't be moved"
8999
+ },
9000
+ grabFeedback.at
9001
+ ) : null,
8950
9002
  insideRect && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
8951
9003
  "div",
8952
9004
  {
@@ -4892,6 +4892,16 @@ function buildNodeSelector(nodeId) {
4892
4892
  var LARGE_NODE_NEST_BLOCK_MIN_WIDTH = 520;
4893
4893
  var LARGE_NODE_NEST_BLOCK_MIN_HEIGHT = 260;
4894
4894
  var LARGE_NODE_NEST_BLOCK_MIN_AREA = 18e4;
4895
+ function resolveGrabFeedbackTarget(target, scannedByNodeId) {
4896
+ if (!(target instanceof Element)) return null;
4897
+ if (target.closest("[data-design-mode-ui]")) return null;
4898
+ const host = target.closest(`[${DND_NODE_ID_ATTR}]`);
4899
+ if (!host) return null;
4900
+ const nodeId = host.getAttribute(DND_NODE_ID_ATTR);
4901
+ const scanned = nodeId ? scannedByNodeId.get(nodeId) : null;
4902
+ if (!scanned || scanned.draggable !== false) return null;
4903
+ return scanned;
4904
+ }
4895
4905
  function isEligibleForDrag(sc) {
4896
4906
  if (sc.draggable === false) return false;
4897
4907
  const source = sc.eligibilitySource ?? "editor-meta";
@@ -8701,6 +8711,25 @@ function DesignModeOverlay() {
8701
8711
  for (const el of draggableElements) m.set(el.nodeId, el);
8702
8712
  refs.draggableNodeMapRef.current = m;
8703
8713
  }, [draggableElements]);
8714
+ const [grabFeedback, setGrabFeedback] = useState6(null);
8715
+ useEffect12(() => {
8716
+ if (!enabled) return;
8717
+ const onPointerDown = (e) => {
8718
+ const scanned = resolveGrabFeedbackTarget(
8719
+ e.target,
8720
+ refs.nodeMapRef.current
8721
+ );
8722
+ if (!scanned) return;
8723
+ setGrabFeedback({ x: e.clientX, y: e.clientY, at: Date.now() });
8724
+ };
8725
+ document.addEventListener("pointerdown", onPointerDown, true);
8726
+ return () => document.removeEventListener("pointerdown", onPointerDown, true);
8727
+ }, [enabled]);
8728
+ useEffect12(() => {
8729
+ if (!grabFeedback) return;
8730
+ const t = setTimeout(() => setGrabFeedback(null), 1400);
8731
+ return () => clearTimeout(t);
8732
+ }, [grabFeedback]);
8704
8733
  const resolveNodeElement = useCallback8((nodeId) => {
8705
8734
  const known = refs.nodeMapRef.current.get(nodeId)?.element;
8706
8735
  if (known) return known;
@@ -8912,6 +8941,29 @@ function DesignModeOverlay() {
8912
8941
  },
8913
8942
  el.nodeId
8914
8943
  )),
8944
+ grabFeedback ? /* @__PURE__ */ jsx4(
8945
+ "div",
8946
+ {
8947
+ "data-design-mode-ui": "true",
8948
+ style: {
8949
+ position: "fixed",
8950
+ left: grabFeedback.x,
8951
+ top: grabFeedback.y - 34,
8952
+ transform: "translateX(-50%)",
8953
+ zIndex: 2147483646,
8954
+ pointerEvents: "none",
8955
+ background: "rgba(23, 23, 23, 0.92)",
8956
+ color: "#fff",
8957
+ font: "500 11px/1.4 system-ui, sans-serif",
8958
+ padding: "4px 8px",
8959
+ borderRadius: 6,
8960
+ whiteSpace: "nowrap",
8961
+ boxShadow: "0 2px 8px rgba(0,0,0,0.25)"
8962
+ },
8963
+ children: "This element can't be moved"
8964
+ },
8965
+ grabFeedback.at
8966
+ ) : null,
8915
8967
  insideRect && /* @__PURE__ */ jsx4(
8916
8968
  "div",
8917
8969
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "repository": {
6
6
  "type": "git",