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