@almadar/ui 4.50.2 → 4.50.3

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.
@@ -24942,6 +24942,10 @@ function useDataDnd(args) {
24942
24942
  const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
24943
24943
  zonesRef.current.delete(zoneId2);
24944
24944
  }, []);
24945
+ const [overlayNode, setOverlayNode] = React93__namespace.default.useState(null);
24946
+ const setOverlay = React93__namespace.default.useCallback((node) => {
24947
+ setOverlayNode(node);
24948
+ }, []);
24945
24949
  const zoneId = React93__namespace.default.useId();
24946
24950
  const ownGroup = dragGroup ?? accepts ?? zoneId;
24947
24951
  const meta = React93__namespace.default.useMemo(
@@ -25025,6 +25029,7 @@ function useDataDnd(args) {
25025
25029
  },
25026
25030
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
25027
25031
  );
25032
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
25028
25033
  const SortableItem = React93__namespace.default.useCallback(
25029
25034
  ({ id, children }) => {
25030
25035
  const {
@@ -25035,6 +25040,11 @@ function useDataDnd(args) {
25035
25040
  transition,
25036
25041
  isDragging
25037
25042
  } = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
25043
+ React93__namespace.default.useEffect(() => {
25044
+ if (!isDragging || !overlaySink) return;
25045
+ overlaySink(children);
25046
+ return () => overlaySink(null);
25047
+ }, [isDragging, children]);
25038
25048
  const style = {
25039
25049
  transform: utilities.CSS.Transform.toString(transform),
25040
25050
  transition,
@@ -25053,7 +25063,7 @@ function useDataDnd(args) {
25053
25063
  }
25054
25064
  );
25055
25065
  },
25056
- [ownGroup, enabled]
25066
+ [ownGroup, enabled, overlaySink]
25057
25067
  );
25058
25068
  const DropZoneShell = ({ children }) => {
25059
25069
  const { setNodeRef, isOver } = core$1.useDroppable({
@@ -25071,24 +25081,55 @@ function useDataDnd(args) {
25071
25081
  );
25072
25082
  };
25073
25083
  const rootContextValue = React93__namespace.default.useMemo(
25074
- () => ({ registerZone, unregisterZone }),
25075
- [registerZone, unregisterZone]
25084
+ () => ({ registerZone, unregisterZone, setOverlay }),
25085
+ [registerZone, unregisterZone, setOverlay]
25076
25086
  );
25077
25087
  const wrapContainer = React93__namespace.default.useCallback(
25078
25088
  (children) => {
25079
25089
  if (!enabled) return children;
25080
25090
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
25091
+ const clearOverlay = () => setOverlay(null);
25081
25092
  if (!isZone) {
25082
25093
  if (!isRoot) return children;
25083
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25094
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
25095
+ core$1.DndContext,
25096
+ {
25097
+ sensors,
25098
+ collisionDetection,
25099
+ onDragEnd: (e) => {
25100
+ handleDragEnd(e);
25101
+ clearOverlay();
25102
+ },
25103
+ onDragCancel: clearOverlay,
25104
+ children: [
25105
+ children,
25106
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
25107
+ ]
25108
+ }
25109
+ ) });
25084
25110
  }
25085
25111
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
25086
25112
  if (isRoot) {
25087
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
25113
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
25114
+ core$1.DndContext,
25115
+ {
25116
+ sensors,
25117
+ collisionDetection,
25118
+ onDragEnd: (e) => {
25119
+ handleDragEnd(e);
25120
+ clearOverlay();
25121
+ },
25122
+ onDragCancel: clearOverlay,
25123
+ children: [
25124
+ inner,
25125
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
25126
+ ]
25127
+ }
25128
+ ) });
25088
25129
  }
25089
25130
  return inner;
25090
25131
  },
25091
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25132
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
25092
25133
  );
25093
25134
  return {
25094
25135
  enabled,
package/dist/avl/index.js CHANGED
@@ -34,7 +34,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
34
34
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
35
35
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
36
36
  import { FieldTypeSchema, isInlineTrait, isEntityCall, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
37
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
37
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
38
38
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
39
39
  import { CSS } from '@dnd-kit/utilities';
40
40
  import { useThree, useFrame, Canvas } from '@react-three/fiber';
@@ -24896,6 +24896,10 @@ function useDataDnd(args) {
24896
24896
  const unregisterZone = React93__default.useCallback((zoneId2) => {
24897
24897
  zonesRef.current.delete(zoneId2);
24898
24898
  }, []);
24899
+ const [overlayNode, setOverlayNode] = React93__default.useState(null);
24900
+ const setOverlay = React93__default.useCallback((node) => {
24901
+ setOverlayNode(node);
24902
+ }, []);
24899
24903
  const zoneId = React93__default.useId();
24900
24904
  const ownGroup = dragGroup ?? accepts ?? zoneId;
24901
24905
  const meta = React93__default.useMemo(
@@ -24979,6 +24983,7 @@ function useDataDnd(args) {
24979
24983
  },
24980
24984
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
24981
24985
  );
24986
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
24982
24987
  const SortableItem = React93__default.useCallback(
24983
24988
  ({ id, children }) => {
24984
24989
  const {
@@ -24989,6 +24994,11 @@ function useDataDnd(args) {
24989
24994
  transition,
24990
24995
  isDragging
24991
24996
  } = useSortable({ id, data: { dndGroup: ownGroup } });
24997
+ React93__default.useEffect(() => {
24998
+ if (!isDragging || !overlaySink) return;
24999
+ overlaySink(children);
25000
+ return () => overlaySink(null);
25001
+ }, [isDragging, children]);
24992
25002
  const style = {
24993
25003
  transform: CSS.Transform.toString(transform),
24994
25004
  transition,
@@ -25007,7 +25017,7 @@ function useDataDnd(args) {
25007
25017
  }
25008
25018
  );
25009
25019
  },
25010
- [ownGroup, enabled]
25020
+ [ownGroup, enabled, overlaySink]
25011
25021
  );
25012
25022
  const DropZoneShell = ({ children }) => {
25013
25023
  const { setNodeRef, isOver } = useDroppable({
@@ -25025,24 +25035,55 @@ function useDataDnd(args) {
25025
25035
  );
25026
25036
  };
25027
25037
  const rootContextValue = React93__default.useMemo(
25028
- () => ({ registerZone, unregisterZone }),
25029
- [registerZone, unregisterZone]
25038
+ () => ({ registerZone, unregisterZone, setOverlay }),
25039
+ [registerZone, unregisterZone, setOverlay]
25030
25040
  );
25031
25041
  const wrapContainer = React93__default.useCallback(
25032
25042
  (children) => {
25033
25043
  if (!enabled) return children;
25034
25044
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
25045
+ const clearOverlay = () => setOverlay(null);
25035
25046
  if (!isZone) {
25036
25047
  if (!isRoot) return children;
25037
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
25048
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
25049
+ DndContext,
25050
+ {
25051
+ sensors,
25052
+ collisionDetection,
25053
+ onDragEnd: (e) => {
25054
+ handleDragEnd(e);
25055
+ clearOverlay();
25056
+ },
25057
+ onDragCancel: clearOverlay,
25058
+ children: [
25059
+ children,
25060
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
25061
+ ]
25062
+ }
25063
+ ) });
25038
25064
  }
25039
25065
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
25040
25066
  if (isRoot) {
25041
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
25067
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
25068
+ DndContext,
25069
+ {
25070
+ sensors,
25071
+ collisionDetection,
25072
+ onDragEnd: (e) => {
25073
+ handleDragEnd(e);
25074
+ clearOverlay();
25075
+ },
25076
+ onDragCancel: clearOverlay,
25077
+ children: [
25078
+ inner,
25079
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
25080
+ ]
25081
+ }
25082
+ ) });
25042
25083
  }
25043
25084
  return inner;
25044
25085
  },
25045
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
25086
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
25046
25087
  );
25047
25088
  return {
25048
25089
  enabled,
@@ -20109,6 +20109,10 @@ function useDataDnd(args) {
20109
20109
  const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
20110
20110
  zonesRef.current.delete(zoneId2);
20111
20111
  }, []);
20112
+ const [overlayNode, setOverlayNode] = React75__namespace.default.useState(null);
20113
+ const setOverlay = React75__namespace.default.useCallback((node) => {
20114
+ setOverlayNode(node);
20115
+ }, []);
20112
20116
  const zoneId = React75__namespace.default.useId();
20113
20117
  const ownGroup = dragGroup ?? accepts ?? zoneId;
20114
20118
  const meta = React75__namespace.default.useMemo(
@@ -20192,6 +20196,7 @@ function useDataDnd(args) {
20192
20196
  },
20193
20197
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
20194
20198
  );
20199
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
20195
20200
  const SortableItem = React75__namespace.default.useCallback(
20196
20201
  ({ id, children }) => {
20197
20202
  const {
@@ -20202,6 +20207,11 @@ function useDataDnd(args) {
20202
20207
  transition,
20203
20208
  isDragging
20204
20209
  } = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
20210
+ React75__namespace.default.useEffect(() => {
20211
+ if (!isDragging || !overlaySink) return;
20212
+ overlaySink(children);
20213
+ return () => overlaySink(null);
20214
+ }, [isDragging, children]);
20205
20215
  const style = {
20206
20216
  transform: utilities.CSS.Transform.toString(transform),
20207
20217
  transition,
@@ -20220,7 +20230,7 @@ function useDataDnd(args) {
20220
20230
  }
20221
20231
  );
20222
20232
  },
20223
- [ownGroup, enabled]
20233
+ [ownGroup, enabled, overlaySink]
20224
20234
  );
20225
20235
  const DropZoneShell = ({ children }) => {
20226
20236
  const { setNodeRef, isOver } = core$1.useDroppable({
@@ -20238,24 +20248,55 @@ function useDataDnd(args) {
20238
20248
  );
20239
20249
  };
20240
20250
  const rootContextValue = React75__namespace.default.useMemo(
20241
- () => ({ registerZone, unregisterZone }),
20242
- [registerZone, unregisterZone]
20251
+ () => ({ registerZone, unregisterZone, setOverlay }),
20252
+ [registerZone, unregisterZone, setOverlay]
20243
20253
  );
20244
20254
  const wrapContainer = React75__namespace.default.useCallback(
20245
20255
  (children) => {
20246
20256
  if (!enabled) return children;
20247
20257
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
20258
+ const clearOverlay = () => setOverlay(null);
20248
20259
  if (!isZone) {
20249
20260
  if (!isRoot) return children;
20250
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20261
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
20262
+ core$1.DndContext,
20263
+ {
20264
+ sensors,
20265
+ collisionDetection,
20266
+ onDragEnd: (e) => {
20267
+ handleDragEnd(e);
20268
+ clearOverlay();
20269
+ },
20270
+ onDragCancel: clearOverlay,
20271
+ children: [
20272
+ children,
20273
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
20274
+ ]
20275
+ }
20276
+ ) });
20251
20277
  }
20252
20278
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
20253
20279
  if (isRoot) {
20254
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
20280
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
20281
+ core$1.DndContext,
20282
+ {
20283
+ sensors,
20284
+ collisionDetection,
20285
+ onDragEnd: (e) => {
20286
+ handleDragEnd(e);
20287
+ clearOverlay();
20288
+ },
20289
+ onDragCancel: clearOverlay,
20290
+ children: [
20291
+ inner,
20292
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
20293
+ ]
20294
+ }
20295
+ ) });
20255
20296
  }
20256
20297
  return inner;
20257
20298
  },
20258
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20299
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
20259
20300
  );
20260
20301
  return {
20261
20302
  enabled,
@@ -35,7 +35,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
35
35
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
36
36
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
37
37
  import { isInlineTrait } from '@almadar/core';
38
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
38
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
39
39
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
40
40
  import { CSS } from '@dnd-kit/utilities';
41
41
  import { Handle, Position } from '@xyflow/react';
@@ -20063,6 +20063,10 @@ function useDataDnd(args) {
20063
20063
  const unregisterZone = React75__default.useCallback((zoneId2) => {
20064
20064
  zonesRef.current.delete(zoneId2);
20065
20065
  }, []);
20066
+ const [overlayNode, setOverlayNode] = React75__default.useState(null);
20067
+ const setOverlay = React75__default.useCallback((node) => {
20068
+ setOverlayNode(node);
20069
+ }, []);
20066
20070
  const zoneId = React75__default.useId();
20067
20071
  const ownGroup = dragGroup ?? accepts ?? zoneId;
20068
20072
  const meta = React75__default.useMemo(
@@ -20146,6 +20150,7 @@ function useDataDnd(args) {
20146
20150
  },
20147
20151
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
20148
20152
  );
20153
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
20149
20154
  const SortableItem = React75__default.useCallback(
20150
20155
  ({ id, children }) => {
20151
20156
  const {
@@ -20156,6 +20161,11 @@ function useDataDnd(args) {
20156
20161
  transition,
20157
20162
  isDragging
20158
20163
  } = useSortable({ id, data: { dndGroup: ownGroup } });
20164
+ React75__default.useEffect(() => {
20165
+ if (!isDragging || !overlaySink) return;
20166
+ overlaySink(children);
20167
+ return () => overlaySink(null);
20168
+ }, [isDragging, children]);
20159
20169
  const style = {
20160
20170
  transform: CSS.Transform.toString(transform),
20161
20171
  transition,
@@ -20174,7 +20184,7 @@ function useDataDnd(args) {
20174
20184
  }
20175
20185
  );
20176
20186
  },
20177
- [ownGroup, enabled]
20187
+ [ownGroup, enabled, overlaySink]
20178
20188
  );
20179
20189
  const DropZoneShell = ({ children }) => {
20180
20190
  const { setNodeRef, isOver } = useDroppable({
@@ -20192,24 +20202,55 @@ function useDataDnd(args) {
20192
20202
  );
20193
20203
  };
20194
20204
  const rootContextValue = React75__default.useMemo(
20195
- () => ({ registerZone, unregisterZone }),
20196
- [registerZone, unregisterZone]
20205
+ () => ({ registerZone, unregisterZone, setOverlay }),
20206
+ [registerZone, unregisterZone, setOverlay]
20197
20207
  );
20198
20208
  const wrapContainer = React75__default.useCallback(
20199
20209
  (children) => {
20200
20210
  if (!enabled) return children;
20201
20211
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
20212
+ const clearOverlay = () => setOverlay(null);
20202
20213
  if (!isZone) {
20203
20214
  if (!isRoot) return children;
20204
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
20215
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
20216
+ DndContext,
20217
+ {
20218
+ sensors,
20219
+ collisionDetection,
20220
+ onDragEnd: (e) => {
20221
+ handleDragEnd(e);
20222
+ clearOverlay();
20223
+ },
20224
+ onDragCancel: clearOverlay,
20225
+ children: [
20226
+ children,
20227
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
20228
+ ]
20229
+ }
20230
+ ) });
20205
20231
  }
20206
20232
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
20207
20233
  if (isRoot) {
20208
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
20234
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
20235
+ DndContext,
20236
+ {
20237
+ sensors,
20238
+ collisionDetection,
20239
+ onDragEnd: (e) => {
20240
+ handleDragEnd(e);
20241
+ clearOverlay();
20242
+ },
20243
+ onDragCancel: clearOverlay,
20244
+ children: [
20245
+ inner,
20246
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
20247
+ ]
20248
+ }
20249
+ ) });
20209
20250
  }
20210
20251
  return inner;
20211
20252
  },
20212
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
20253
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
20213
20254
  );
20214
20255
  return {
20215
20256
  enabled,
@@ -21354,6 +21354,10 @@ function useDataDnd(args) {
21354
21354
  const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
21355
21355
  zonesRef.current.delete(zoneId2);
21356
21356
  }, []);
21357
+ const [overlayNode, setOverlayNode] = React81__namespace.default.useState(null);
21358
+ const setOverlay = React81__namespace.default.useCallback((node) => {
21359
+ setOverlayNode(node);
21360
+ }, []);
21357
21361
  const zoneId = React81__namespace.default.useId();
21358
21362
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21359
21363
  const meta = React81__namespace.default.useMemo(
@@ -21437,6 +21441,7 @@ function useDataDnd(args) {
21437
21441
  },
21438
21442
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21439
21443
  );
21444
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
21440
21445
  const SortableItem = React81__namespace.default.useCallback(
21441
21446
  ({ id, children }) => {
21442
21447
  const {
@@ -21447,6 +21452,11 @@ function useDataDnd(args) {
21447
21452
  transition,
21448
21453
  isDragging
21449
21454
  } = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
21455
+ React81__namespace.default.useEffect(() => {
21456
+ if (!isDragging || !overlaySink) return;
21457
+ overlaySink(children);
21458
+ return () => overlaySink(null);
21459
+ }, [isDragging, children]);
21450
21460
  const style = {
21451
21461
  transform: utilities.CSS.Transform.toString(transform),
21452
21462
  transition,
@@ -21465,7 +21475,7 @@ function useDataDnd(args) {
21465
21475
  }
21466
21476
  );
21467
21477
  },
21468
- [ownGroup, enabled]
21478
+ [ownGroup, enabled, overlaySink]
21469
21479
  );
21470
21480
  const DropZoneShell = ({ children }) => {
21471
21481
  const { setNodeRef, isOver } = core$1.useDroppable({
@@ -21483,24 +21493,55 @@ function useDataDnd(args) {
21483
21493
  );
21484
21494
  };
21485
21495
  const rootContextValue = React81__namespace.default.useMemo(
21486
- () => ({ registerZone, unregisterZone }),
21487
- [registerZone, unregisterZone]
21496
+ () => ({ registerZone, unregisterZone, setOverlay }),
21497
+ [registerZone, unregisterZone, setOverlay]
21488
21498
  );
21489
21499
  const wrapContainer = React81__namespace.default.useCallback(
21490
21500
  (children) => {
21491
21501
  if (!enabled) return children;
21492
21502
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21503
+ const clearOverlay = () => setOverlay(null);
21493
21504
  if (!isZone) {
21494
21505
  if (!isRoot) return children;
21495
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21506
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
21507
+ core$1.DndContext,
21508
+ {
21509
+ sensors,
21510
+ collisionDetection,
21511
+ onDragEnd: (e) => {
21512
+ handleDragEnd(e);
21513
+ clearOverlay();
21514
+ },
21515
+ onDragCancel: clearOverlay,
21516
+ children: [
21517
+ children,
21518
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
21519
+ ]
21520
+ }
21521
+ ) });
21496
21522
  }
21497
21523
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21498
21524
  if (isRoot) {
21499
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21525
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
21526
+ core$1.DndContext,
21527
+ {
21528
+ sensors,
21529
+ collisionDetection,
21530
+ onDragEnd: (e) => {
21531
+ handleDragEnd(e);
21532
+ clearOverlay();
21533
+ },
21534
+ onDragCancel: clearOverlay,
21535
+ children: [
21536
+ inner,
21537
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
21538
+ ]
21539
+ }
21540
+ ) });
21500
21541
  }
21501
21542
  return inner;
21502
21543
  },
21503
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21544
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
21504
21545
  );
21505
21546
  return {
21506
21547
  enabled,
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isInlineTrait } from '@almadar/core';
39
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
40
40
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
41
  import { CSS } from '@dnd-kit/utilities';
42
42
  import { Handle, Position } from '@xyflow/react';
@@ -21308,6 +21308,10 @@ function useDataDnd(args) {
21308
21308
  const unregisterZone = React81__default.useCallback((zoneId2) => {
21309
21309
  zonesRef.current.delete(zoneId2);
21310
21310
  }, []);
21311
+ const [overlayNode, setOverlayNode] = React81__default.useState(null);
21312
+ const setOverlay = React81__default.useCallback((node) => {
21313
+ setOverlayNode(node);
21314
+ }, []);
21311
21315
  const zoneId = React81__default.useId();
21312
21316
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21313
21317
  const meta = React81__default.useMemo(
@@ -21391,6 +21395,7 @@ function useDataDnd(args) {
21391
21395
  },
21392
21396
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21393
21397
  );
21398
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
21394
21399
  const SortableItem = React81__default.useCallback(
21395
21400
  ({ id, children }) => {
21396
21401
  const {
@@ -21401,6 +21406,11 @@ function useDataDnd(args) {
21401
21406
  transition,
21402
21407
  isDragging
21403
21408
  } = useSortable({ id, data: { dndGroup: ownGroup } });
21409
+ React81__default.useEffect(() => {
21410
+ if (!isDragging || !overlaySink) return;
21411
+ overlaySink(children);
21412
+ return () => overlaySink(null);
21413
+ }, [isDragging, children]);
21404
21414
  const style = {
21405
21415
  transform: CSS.Transform.toString(transform),
21406
21416
  transition,
@@ -21419,7 +21429,7 @@ function useDataDnd(args) {
21419
21429
  }
21420
21430
  );
21421
21431
  },
21422
- [ownGroup, enabled]
21432
+ [ownGroup, enabled, overlaySink]
21423
21433
  );
21424
21434
  const DropZoneShell = ({ children }) => {
21425
21435
  const { setNodeRef, isOver } = useDroppable({
@@ -21437,24 +21447,55 @@ function useDataDnd(args) {
21437
21447
  );
21438
21448
  };
21439
21449
  const rootContextValue = React81__default.useMemo(
21440
- () => ({ registerZone, unregisterZone }),
21441
- [registerZone, unregisterZone]
21450
+ () => ({ registerZone, unregisterZone, setOverlay }),
21451
+ [registerZone, unregisterZone, setOverlay]
21442
21452
  );
21443
21453
  const wrapContainer = React81__default.useCallback(
21444
21454
  (children) => {
21445
21455
  if (!enabled) return children;
21446
21456
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21457
+ const clearOverlay = () => setOverlay(null);
21447
21458
  if (!isZone) {
21448
21459
  if (!isRoot) return children;
21449
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21460
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
21461
+ DndContext,
21462
+ {
21463
+ sensors,
21464
+ collisionDetection,
21465
+ onDragEnd: (e) => {
21466
+ handleDragEnd(e);
21467
+ clearOverlay();
21468
+ },
21469
+ onDragCancel: clearOverlay,
21470
+ children: [
21471
+ children,
21472
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
21473
+ ]
21474
+ }
21475
+ ) });
21450
21476
  }
21451
21477
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21452
21478
  if (isRoot) {
21453
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21479
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
21480
+ DndContext,
21481
+ {
21482
+ sensors,
21483
+ collisionDetection,
21484
+ onDragEnd: (e) => {
21485
+ handleDragEnd(e);
21486
+ clearOverlay();
21487
+ },
21488
+ onDragCancel: clearOverlay,
21489
+ children: [
21490
+ inner,
21491
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
21492
+ ]
21493
+ }
21494
+ ) });
21454
21495
  }
21455
21496
  return inner;
21456
21497
  },
21457
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21498
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
21458
21499
  );
21459
21500
  return {
21460
21501
  enabled,
@@ -21123,6 +21123,10 @@ function useDataDnd(args) {
21123
21123
  const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
21124
21124
  zonesRef.current.delete(zoneId2);
21125
21125
  }, []);
21126
+ const [overlayNode, setOverlayNode] = React80__namespace.default.useState(null);
21127
+ const setOverlay = React80__namespace.default.useCallback((node) => {
21128
+ setOverlayNode(node);
21129
+ }, []);
21126
21130
  const zoneId = React80__namespace.default.useId();
21127
21131
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21128
21132
  const meta = React80__namespace.default.useMemo(
@@ -21206,6 +21210,7 @@ function useDataDnd(args) {
21206
21210
  },
21207
21211
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21208
21212
  );
21213
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
21209
21214
  const SortableItem = React80__namespace.default.useCallback(
21210
21215
  ({ id, children }) => {
21211
21216
  const {
@@ -21216,6 +21221,11 @@ function useDataDnd(args) {
21216
21221
  transition,
21217
21222
  isDragging
21218
21223
  } = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
21224
+ React80__namespace.default.useEffect(() => {
21225
+ if (!isDragging || !overlaySink) return;
21226
+ overlaySink(children);
21227
+ return () => overlaySink(null);
21228
+ }, [isDragging, children]);
21219
21229
  const style = {
21220
21230
  transform: utilities.CSS.Transform.toString(transform),
21221
21231
  transition,
@@ -21234,7 +21244,7 @@ function useDataDnd(args) {
21234
21244
  }
21235
21245
  );
21236
21246
  },
21237
- [ownGroup, enabled]
21247
+ [ownGroup, enabled, overlaySink]
21238
21248
  );
21239
21249
  const DropZoneShell = ({ children }) => {
21240
21250
  const { setNodeRef, isOver } = core$1.useDroppable({
@@ -21252,24 +21262,55 @@ function useDataDnd(args) {
21252
21262
  );
21253
21263
  };
21254
21264
  const rootContextValue = React80__namespace.default.useMemo(
21255
- () => ({ registerZone, unregisterZone }),
21256
- [registerZone, unregisterZone]
21265
+ () => ({ registerZone, unregisterZone, setOverlay }),
21266
+ [registerZone, unregisterZone, setOverlay]
21257
21267
  );
21258
21268
  const wrapContainer = React80__namespace.default.useCallback(
21259
21269
  (children) => {
21260
21270
  if (!enabled) return children;
21261
21271
  const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
21272
+ const clearOverlay = () => setOverlay(null);
21262
21273
  if (!isZone) {
21263
21274
  if (!isRoot) return children;
21264
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21275
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
21276
+ core$1.DndContext,
21277
+ {
21278
+ sensors,
21279
+ collisionDetection,
21280
+ onDragEnd: (e) => {
21281
+ handleDragEnd(e);
21282
+ clearOverlay();
21283
+ },
21284
+ onDragCancel: clearOverlay,
21285
+ children: [
21286
+ children,
21287
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
21288
+ ]
21289
+ }
21290
+ ) });
21265
21291
  }
21266
21292
  const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
21267
21293
  if (isRoot) {
21268
- return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21294
+ return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
21295
+ core$1.DndContext,
21296
+ {
21297
+ sensors,
21298
+ collisionDetection,
21299
+ onDragEnd: (e) => {
21300
+ handleDragEnd(e);
21301
+ clearOverlay();
21302
+ },
21303
+ onDragCancel: clearOverlay,
21304
+ children: [
21305
+ inner,
21306
+ /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
21307
+ ]
21308
+ }
21309
+ ) });
21269
21310
  }
21270
21311
  return inner;
21271
21312
  },
21272
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21313
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
21273
21314
  );
21274
21315
  return {
21275
21316
  enabled,
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
36
36
  import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
37
37
  import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
38
38
  import { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, isInlineTrait } from '@almadar/core';
39
- import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
39
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
40
40
  import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
41
41
  import { CSS } from '@dnd-kit/utilities';
42
42
  import { Handle, Position } from '@xyflow/react';
@@ -21077,6 +21077,10 @@ function useDataDnd(args) {
21077
21077
  const unregisterZone = React80__default.useCallback((zoneId2) => {
21078
21078
  zonesRef.current.delete(zoneId2);
21079
21079
  }, []);
21080
+ const [overlayNode, setOverlayNode] = React80__default.useState(null);
21081
+ const setOverlay = React80__default.useCallback((node) => {
21082
+ setOverlayNode(node);
21083
+ }, []);
21080
21084
  const zoneId = React80__default.useId();
21081
21085
  const ownGroup = dragGroup ?? accepts ?? zoneId;
21082
21086
  const meta = React80__default.useMemo(
@@ -21160,6 +21164,7 @@ function useDataDnd(args) {
21160
21164
  },
21161
21165
  [orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
21162
21166
  );
21167
+ const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
21163
21168
  const SortableItem = React80__default.useCallback(
21164
21169
  ({ id, children }) => {
21165
21170
  const {
@@ -21170,6 +21175,11 @@ function useDataDnd(args) {
21170
21175
  transition,
21171
21176
  isDragging
21172
21177
  } = useSortable({ id, data: { dndGroup: ownGroup } });
21178
+ React80__default.useEffect(() => {
21179
+ if (!isDragging || !overlaySink) return;
21180
+ overlaySink(children);
21181
+ return () => overlaySink(null);
21182
+ }, [isDragging, children]);
21173
21183
  const style = {
21174
21184
  transform: CSS.Transform.toString(transform),
21175
21185
  transition,
@@ -21188,7 +21198,7 @@ function useDataDnd(args) {
21188
21198
  }
21189
21199
  );
21190
21200
  },
21191
- [ownGroup, enabled]
21201
+ [ownGroup, enabled, overlaySink]
21192
21202
  );
21193
21203
  const DropZoneShell = ({ children }) => {
21194
21204
  const { setNodeRef, isOver } = useDroppable({
@@ -21206,24 +21216,55 @@ function useDataDnd(args) {
21206
21216
  );
21207
21217
  };
21208
21218
  const rootContextValue = React80__default.useMemo(
21209
- () => ({ registerZone, unregisterZone }),
21210
- [registerZone, unregisterZone]
21219
+ () => ({ registerZone, unregisterZone, setOverlay }),
21220
+ [registerZone, unregisterZone, setOverlay]
21211
21221
  );
21212
21222
  const wrapContainer = React80__default.useCallback(
21213
21223
  (children) => {
21214
21224
  if (!enabled) return children;
21215
21225
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
21226
+ const clearOverlay = () => setOverlay(null);
21216
21227
  if (!isZone) {
21217
21228
  if (!isRoot) return children;
21218
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
21229
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
21230
+ DndContext,
21231
+ {
21232
+ sensors,
21233
+ collisionDetection,
21234
+ onDragEnd: (e) => {
21235
+ handleDragEnd(e);
21236
+ clearOverlay();
21237
+ },
21238
+ onDragCancel: clearOverlay,
21239
+ children: [
21240
+ children,
21241
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
21242
+ ]
21243
+ }
21244
+ ) });
21219
21245
  }
21220
21246
  const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
21221
21247
  if (isRoot) {
21222
- return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
21248
+ return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
21249
+ DndContext,
21250
+ {
21251
+ sensors,
21252
+ collisionDetection,
21253
+ onDragEnd: (e) => {
21254
+ handleDragEnd(e);
21255
+ clearOverlay();
21256
+ },
21257
+ onDragCancel: clearOverlay,
21258
+ children: [
21259
+ inner,
21260
+ /* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
21261
+ ]
21262
+ }
21263
+ ) });
21223
21264
  }
21224
21265
  return inner;
21225
21266
  },
21226
- [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
21267
+ [enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
21227
21268
  );
21228
21269
  return {
21229
21270
  enabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.50.2",
3
+ "version": "4.50.3",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [