@almadar/ui 4.51.0 → 4.51.1

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.
@@ -59158,13 +59158,19 @@ function defaultEmit(eventBus, drop) {
59158
59158
  }
59159
59159
  log18.debug("default-emit:unhandled-kind", { kind: payload.kind });
59160
59160
  }
59161
- function CanvasDndProvider({ children, onDrop }) {
59161
+ function CanvasDndProvider({
59162
+ children,
59163
+ onDrop,
59164
+ renderOverlay
59165
+ }) {
59162
59166
  const eventBus = useEventBus();
59163
59167
  const sensors = useAlmadarDndSensors(false);
59168
+ const [activePayload, setActivePayload] = React93__namespace.default.useState(null);
59164
59169
  const handleDragStart = React93__namespace.default.useCallback((e) => {
59165
59170
  const data = e.active.data.current;
59166
59171
  const payload = data?.payload;
59167
59172
  if (payload) {
59173
+ setActivePayload(payload);
59168
59174
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
59169
59175
  log18.info("dragStart", { id: e.active.id, kind: payload.kind });
59170
59176
  } else {
@@ -59172,6 +59178,7 @@ function CanvasDndProvider({ children, onDrop }) {
59172
59178
  }
59173
59179
  }, [eventBus]);
59174
59180
  const handleDragEnd = React93__namespace.default.useCallback((e) => {
59181
+ setActivePayload(null);
59175
59182
  const activeData = e.active.data.current;
59176
59183
  const payload = activeData?.payload;
59177
59184
  const overData = e.over?.data.current;
@@ -59199,14 +59206,22 @@ function CanvasDndProvider({ children, onDrop }) {
59199
59206
  const suppressed = onDrop ? onDrop(drop) === true : false;
59200
59207
  if (!suppressed) defaultEmit(eventBus, drop);
59201
59208
  }, [eventBus, onDrop]);
59202
- return /* @__PURE__ */ jsxRuntime.jsx(
59209
+ const handleDragCancel = React93__namespace.default.useCallback(() => {
59210
+ setActivePayload(null);
59211
+ log18.info("dragCancel");
59212
+ }, []);
59213
+ return /* @__PURE__ */ jsxRuntime.jsxs(
59203
59214
  core$1.DndContext,
59204
59215
  {
59205
59216
  sensors,
59206
59217
  collisionDetection: almadarDndCollisionDetection,
59207
59218
  onDragStart: handleDragStart,
59208
59219
  onDragEnd: handleDragEnd,
59209
- children
59220
+ onDragCancel: handleDragCancel,
59221
+ children: [
59222
+ children,
59223
+ renderOverlay ? /* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { dropAnimation: null, children: activePayload ? renderOverlay(activePayload) : null }) : null
59224
+ ]
59210
59225
  }
59211
59226
  );
59212
59227
  }
@@ -1312,13 +1312,24 @@ interface CanvasDndProviderProps {
1312
1312
  * `false`/`undefined` to fall through to defaults after running your code.
1313
1313
  */
1314
1314
  onDrop?: (drop: CanvasDropEvent) => boolean | void;
1315
+ /**
1316
+ * Renders the floating preview that follows the cursor during a drag.
1317
+ * @dnd-kit moves the source DOM node via CSS transform, which gets clipped
1318
+ * by any ancestor with `overflow: hidden|auto|scroll` (e.g. a scrollable
1319
+ * palette column). Returning a node here mounts a portal-attached overlay
1320
+ * outside the clip so the user always sees what they're dragging.
1321
+ *
1322
+ * Receives the active payload (or null between drags) and returns the
1323
+ * preview element — typically the same JSX the tile renders inline.
1324
+ */
1325
+ renderOverlay?: (payload: CanvasDragPayload | null) => React__default.ReactNode;
1315
1326
  }
1316
1327
  /**
1317
1328
  * Wraps a canvas subtree in one DndContext + sensors + collision waterfall.
1318
1329
  * Every `useCanvasDraggable` / `useCanvasDroppable` inside this provider
1319
1330
  * participates in the same drag session.
1320
1331
  */
1321
- declare function CanvasDndProvider({ children, onDrop }: CanvasDndProviderProps): React__default.ReactElement;
1332
+ declare function CanvasDndProvider({ children, onDrop, renderOverlay, }: CanvasDndProviderProps): React__default.ReactElement;
1322
1333
 
1323
1334
  /**
1324
1335
  * OrbInspector
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 { useDroppable, useDraggable, DndContext, useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
37
+ import { useDroppable, useDraggable, DndContext, DragOverlay, useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners } from '@dnd-kit/core';
38
38
  import { sortableKeyboardCoordinates, useSortable, arrayMove, 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';
@@ -59112,13 +59112,19 @@ function defaultEmit(eventBus, drop) {
59112
59112
  }
59113
59113
  log18.debug("default-emit:unhandled-kind", { kind: payload.kind });
59114
59114
  }
59115
- function CanvasDndProvider({ children, onDrop }) {
59115
+ function CanvasDndProvider({
59116
+ children,
59117
+ onDrop,
59118
+ renderOverlay
59119
+ }) {
59116
59120
  const eventBus = useEventBus();
59117
59121
  const sensors = useAlmadarDndSensors(false);
59122
+ const [activePayload, setActivePayload] = React93__default.useState(null);
59118
59123
  const handleDragStart = React93__default.useCallback((e) => {
59119
59124
  const data = e.active.data.current;
59120
59125
  const payload = data?.payload;
59121
59126
  if (payload) {
59127
+ setActivePayload(payload);
59122
59128
  eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
59123
59129
  log18.info("dragStart", { id: e.active.id, kind: payload.kind });
59124
59130
  } else {
@@ -59126,6 +59132,7 @@ function CanvasDndProvider({ children, onDrop }) {
59126
59132
  }
59127
59133
  }, [eventBus]);
59128
59134
  const handleDragEnd = React93__default.useCallback((e) => {
59135
+ setActivePayload(null);
59129
59136
  const activeData = e.active.data.current;
59130
59137
  const payload = activeData?.payload;
59131
59138
  const overData = e.over?.data.current;
@@ -59153,14 +59160,22 @@ function CanvasDndProvider({ children, onDrop }) {
59153
59160
  const suppressed = onDrop ? onDrop(drop) === true : false;
59154
59161
  if (!suppressed) defaultEmit(eventBus, drop);
59155
59162
  }, [eventBus, onDrop]);
59156
- return /* @__PURE__ */ jsx(
59163
+ const handleDragCancel = React93__default.useCallback(() => {
59164
+ setActivePayload(null);
59165
+ log18.info("dragCancel");
59166
+ }, []);
59167
+ return /* @__PURE__ */ jsxs(
59157
59168
  DndContext,
59158
59169
  {
59159
59170
  sensors,
59160
59171
  collisionDetection: almadarDndCollisionDetection,
59161
59172
  onDragStart: handleDragStart,
59162
59173
  onDragEnd: handleDragEnd,
59163
- children
59174
+ onDragCancel: handleDragCancel,
59175
+ children: [
59176
+ children,
59177
+ renderOverlay ? /* @__PURE__ */ jsx(DragOverlay, { dropAnimation: null, children: activePayload ? renderOverlay(activePayload) : null }) : null
59178
+ ]
59164
59179
  }
59165
59180
  );
59166
59181
  }
@@ -135,10 +135,21 @@ export interface CanvasDndProviderProps {
135
135
  * `false`/`undefined` to fall through to defaults after running your code.
136
136
  */
137
137
  onDrop?: (drop: CanvasDropEvent) => boolean | void;
138
+ /**
139
+ * Renders the floating preview that follows the cursor during a drag.
140
+ * @dnd-kit moves the source DOM node via CSS transform, which gets clipped
141
+ * by any ancestor with `overflow: hidden|auto|scroll` (e.g. a scrollable
142
+ * palette column). Returning a node here mounts a portal-attached overlay
143
+ * outside the clip so the user always sees what they're dragging.
144
+ *
145
+ * Receives the active payload (or null between drags) and returns the
146
+ * preview element — typically the same JSX the tile renders inline.
147
+ */
148
+ renderOverlay?: (payload: CanvasDragPayload | null) => React.ReactNode;
138
149
  }
139
150
  /**
140
151
  * Wraps a canvas subtree in one DndContext + sensors + collision waterfall.
141
152
  * Every `useCanvasDraggable` / `useCanvasDroppable` inside this provider
142
153
  * participates in the same drag session.
143
154
  */
144
- export declare function CanvasDndProvider({ children, onDrop }: CanvasDndProviderProps): React.ReactElement;
155
+ export declare function CanvasDndProvider({ children, onDrop, renderOverlay, }: CanvasDndProviderProps): React.ReactElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.51.0",
3
+ "version": "4.51.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [