@almadar/ui 4.50.4 → 4.50.5
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/avl/index.cjs +20 -53
- package/dist/avl/index.js +21 -54
- package/dist/components/index.cjs +20 -53
- package/dist/components/index.js +21 -54
- package/dist/providers/index.cjs +20 -53
- package/dist/providers/index.js +21 -54
- package/dist/runtime/index.cjs +20 -53
- package/dist/runtime/index.js +21 -54
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -24928,12 +24928,17 @@ function useDataDnd(args) {
|
|
|
24928
24928
|
React93__namespace.default.useEffect(() => {
|
|
24929
24929
|
setLocalOrder(null);
|
|
24930
24930
|
}, [items]);
|
|
24931
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
24932
|
+
const raw = it[dndItemIdField];
|
|
24933
|
+
return String(raw ?? `__idx_${idx}`);
|
|
24934
|
+
}).join("|");
|
|
24931
24935
|
const itemIds = React93__namespace.default.useMemo(
|
|
24932
24936
|
() => orderedItems.map((it, idx) => {
|
|
24933
24937
|
const raw = it[dndItemIdField];
|
|
24934
24938
|
return raw ?? `__idx_${idx}`;
|
|
24935
24939
|
}),
|
|
24936
|
-
|
|
24940
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24941
|
+
[itemIdsSignature]
|
|
24937
24942
|
);
|
|
24938
24943
|
const zonesRef = React93__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
24939
24944
|
const registerZone = React93__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -24942,10 +24947,6 @@ function useDataDnd(args) {
|
|
|
24942
24947
|
const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
|
|
24943
24948
|
zonesRef.current.delete(zoneId2);
|
|
24944
24949
|
}, []);
|
|
24945
|
-
const [overlayNode, setOverlayNode] = React93__namespace.default.useState(null);
|
|
24946
|
-
const setOverlay = React93__namespace.default.useCallback((node) => {
|
|
24947
|
-
setOverlayNode(node);
|
|
24948
|
-
}, []);
|
|
24949
24950
|
const zoneId = React93__namespace.default.useId();
|
|
24950
24951
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24951
24952
|
const meta = React93__namespace.default.useMemo(
|
|
@@ -25029,7 +25030,7 @@ function useDataDnd(args) {
|
|
|
25029
25030
|
},
|
|
25030
25031
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
25031
25032
|
);
|
|
25032
|
-
const
|
|
25033
|
+
const sortableData = React93__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
25033
25034
|
const SortableItem = React93__namespace.default.useCallback(
|
|
25034
25035
|
({ id, children }) => {
|
|
25035
25036
|
const {
|
|
@@ -25039,19 +25040,16 @@ function useDataDnd(args) {
|
|
|
25039
25040
|
transform,
|
|
25040
25041
|
transition,
|
|
25041
25042
|
isDragging
|
|
25042
|
-
} = sortable.useSortable({ id, data:
|
|
25043
|
-
const childrenRef = React93__namespace.default.useRef(children);
|
|
25044
|
-
childrenRef.current = children;
|
|
25045
|
-
React93__namespace.default.useEffect(() => {
|
|
25046
|
-
if (!isDragging || !overlaySink) return;
|
|
25047
|
-
overlaySink(childrenRef.current);
|
|
25048
|
-
return () => overlaySink(null);
|
|
25049
|
-
}, [isDragging]);
|
|
25043
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
25050
25044
|
const style = {
|
|
25051
25045
|
transform: utilities.CSS.Transform.toString(transform),
|
|
25052
25046
|
transition,
|
|
25053
25047
|
opacity: isDragging ? 0.4 : 1,
|
|
25054
|
-
cursor: enabled ? "grab" : void 0
|
|
25048
|
+
cursor: enabled ? "grab" : void 0,
|
|
25049
|
+
// Lift the dragged element above siblings so its visual movement
|
|
25050
|
+
// isn't hidden behind other cards / column boundaries.
|
|
25051
|
+
zIndex: isDragging ? 50 : void 0,
|
|
25052
|
+
position: isDragging ? "relative" : void 0
|
|
25055
25053
|
};
|
|
25056
25054
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25057
25055
|
Box,
|
|
@@ -25065,12 +25063,12 @@ function useDataDnd(args) {
|
|
|
25065
25063
|
}
|
|
25066
25064
|
);
|
|
25067
25065
|
},
|
|
25068
|
-
[
|
|
25066
|
+
[sortableData, enabled]
|
|
25069
25067
|
);
|
|
25070
25068
|
const DropZoneShell = ({ children }) => {
|
|
25071
25069
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
25072
25070
|
id: `dnd-zone-${zoneId}`,
|
|
25073
|
-
data:
|
|
25071
|
+
data: sortableData
|
|
25074
25072
|
});
|
|
25075
25073
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25076
25074
|
Box,
|
|
@@ -25083,55 +25081,24 @@ function useDataDnd(args) {
|
|
|
25083
25081
|
);
|
|
25084
25082
|
};
|
|
25085
25083
|
const rootContextValue = React93__namespace.default.useMemo(
|
|
25086
|
-
() => ({ registerZone, unregisterZone
|
|
25087
|
-
[registerZone, unregisterZone
|
|
25084
|
+
() => ({ registerZone, unregisterZone }),
|
|
25085
|
+
[registerZone, unregisterZone]
|
|
25088
25086
|
);
|
|
25089
25087
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25090
25088
|
(children) => {
|
|
25091
25089
|
if (!enabled) return children;
|
|
25092
25090
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
25093
|
-
const clearOverlay = () => setOverlay(null);
|
|
25094
25091
|
if (!isZone) {
|
|
25095
25092
|
if (!isRoot) return children;
|
|
25096
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25097
|
-
core$1.DndContext,
|
|
25098
|
-
{
|
|
25099
|
-
sensors,
|
|
25100
|
-
collisionDetection,
|
|
25101
|
-
onDragEnd: (e) => {
|
|
25102
|
-
handleDragEnd(e);
|
|
25103
|
-
clearOverlay();
|
|
25104
|
-
},
|
|
25105
|
-
onDragCancel: clearOverlay,
|
|
25106
|
-
children: [
|
|
25107
|
-
children,
|
|
25108
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25109
|
-
]
|
|
25110
|
-
}
|
|
25111
|
-
) });
|
|
25093
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
25112
25094
|
}
|
|
25113
25095
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
25114
25096
|
if (isRoot) {
|
|
25115
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25116
|
-
core$1.DndContext,
|
|
25117
|
-
{
|
|
25118
|
-
sensors,
|
|
25119
|
-
collisionDetection,
|
|
25120
|
-
onDragEnd: (e) => {
|
|
25121
|
-
handleDragEnd(e);
|
|
25122
|
-
clearOverlay();
|
|
25123
|
-
},
|
|
25124
|
-
onDragCancel: clearOverlay,
|
|
25125
|
-
children: [
|
|
25126
|
-
inner,
|
|
25127
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25128
|
-
]
|
|
25129
|
-
}
|
|
25130
|
-
) });
|
|
25097
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
25131
25098
|
}
|
|
25132
25099
|
return inner;
|
|
25133
25100
|
},
|
|
25134
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
25101
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25135
25102
|
);
|
|
25136
25103
|
return {
|
|
25137
25104
|
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,
|
|
37
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -24882,12 +24882,17 @@ function useDataDnd(args) {
|
|
|
24882
24882
|
React93__default.useEffect(() => {
|
|
24883
24883
|
setLocalOrder(null);
|
|
24884
24884
|
}, [items]);
|
|
24885
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
24886
|
+
const raw = it[dndItemIdField];
|
|
24887
|
+
return String(raw ?? `__idx_${idx}`);
|
|
24888
|
+
}).join("|");
|
|
24885
24889
|
const itemIds = React93__default.useMemo(
|
|
24886
24890
|
() => orderedItems.map((it, idx) => {
|
|
24887
24891
|
const raw = it[dndItemIdField];
|
|
24888
24892
|
return raw ?? `__idx_${idx}`;
|
|
24889
24893
|
}),
|
|
24890
|
-
|
|
24894
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24895
|
+
[itemIdsSignature]
|
|
24891
24896
|
);
|
|
24892
24897
|
const zonesRef = React93__default.useRef(/* @__PURE__ */ new Map());
|
|
24893
24898
|
const registerZone = React93__default.useCallback((zoneId2, meta2) => {
|
|
@@ -24896,10 +24901,6 @@ function useDataDnd(args) {
|
|
|
24896
24901
|
const unregisterZone = React93__default.useCallback((zoneId2) => {
|
|
24897
24902
|
zonesRef.current.delete(zoneId2);
|
|
24898
24903
|
}, []);
|
|
24899
|
-
const [overlayNode, setOverlayNode] = React93__default.useState(null);
|
|
24900
|
-
const setOverlay = React93__default.useCallback((node) => {
|
|
24901
|
-
setOverlayNode(node);
|
|
24902
|
-
}, []);
|
|
24903
24904
|
const zoneId = React93__default.useId();
|
|
24904
24905
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24905
24906
|
const meta = React93__default.useMemo(
|
|
@@ -24983,7 +24984,7 @@ function useDataDnd(args) {
|
|
|
24983
24984
|
},
|
|
24984
24985
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
24985
24986
|
);
|
|
24986
|
-
const
|
|
24987
|
+
const sortableData = React93__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
24987
24988
|
const SortableItem = React93__default.useCallback(
|
|
24988
24989
|
({ id, children }) => {
|
|
24989
24990
|
const {
|
|
@@ -24993,19 +24994,16 @@ function useDataDnd(args) {
|
|
|
24993
24994
|
transform,
|
|
24994
24995
|
transition,
|
|
24995
24996
|
isDragging
|
|
24996
|
-
} = useSortable({ id, data:
|
|
24997
|
-
const childrenRef = React93__default.useRef(children);
|
|
24998
|
-
childrenRef.current = children;
|
|
24999
|
-
React93__default.useEffect(() => {
|
|
25000
|
-
if (!isDragging || !overlaySink) return;
|
|
25001
|
-
overlaySink(childrenRef.current);
|
|
25002
|
-
return () => overlaySink(null);
|
|
25003
|
-
}, [isDragging]);
|
|
24997
|
+
} = useSortable({ id, data: sortableData });
|
|
25004
24998
|
const style = {
|
|
25005
24999
|
transform: CSS.Transform.toString(transform),
|
|
25006
25000
|
transition,
|
|
25007
25001
|
opacity: isDragging ? 0.4 : 1,
|
|
25008
|
-
cursor: enabled ? "grab" : void 0
|
|
25002
|
+
cursor: enabled ? "grab" : void 0,
|
|
25003
|
+
// Lift the dragged element above siblings so its visual movement
|
|
25004
|
+
// isn't hidden behind other cards / column boundaries.
|
|
25005
|
+
zIndex: isDragging ? 50 : void 0,
|
|
25006
|
+
position: isDragging ? "relative" : void 0
|
|
25009
25007
|
};
|
|
25010
25008
|
return /* @__PURE__ */ jsx(
|
|
25011
25009
|
Box,
|
|
@@ -25019,12 +25017,12 @@ function useDataDnd(args) {
|
|
|
25019
25017
|
}
|
|
25020
25018
|
);
|
|
25021
25019
|
},
|
|
25022
|
-
[
|
|
25020
|
+
[sortableData, enabled]
|
|
25023
25021
|
);
|
|
25024
25022
|
const DropZoneShell = ({ children }) => {
|
|
25025
25023
|
const { setNodeRef, isOver } = useDroppable({
|
|
25026
25024
|
id: `dnd-zone-${zoneId}`,
|
|
25027
|
-
data:
|
|
25025
|
+
data: sortableData
|
|
25028
25026
|
});
|
|
25029
25027
|
return /* @__PURE__ */ jsx(
|
|
25030
25028
|
Box,
|
|
@@ -25037,55 +25035,24 @@ function useDataDnd(args) {
|
|
|
25037
25035
|
);
|
|
25038
25036
|
};
|
|
25039
25037
|
const rootContextValue = React93__default.useMemo(
|
|
25040
|
-
() => ({ registerZone, unregisterZone
|
|
25041
|
-
[registerZone, unregisterZone
|
|
25038
|
+
() => ({ registerZone, unregisterZone }),
|
|
25039
|
+
[registerZone, unregisterZone]
|
|
25042
25040
|
);
|
|
25043
25041
|
const wrapContainer = React93__default.useCallback(
|
|
25044
25042
|
(children) => {
|
|
25045
25043
|
if (!enabled) return children;
|
|
25046
25044
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
25047
|
-
const clearOverlay = () => setOverlay(null);
|
|
25048
25045
|
if (!isZone) {
|
|
25049
25046
|
if (!isRoot) return children;
|
|
25050
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25051
|
-
DndContext,
|
|
25052
|
-
{
|
|
25053
|
-
sensors,
|
|
25054
|
-
collisionDetection,
|
|
25055
|
-
onDragEnd: (e) => {
|
|
25056
|
-
handleDragEnd(e);
|
|
25057
|
-
clearOverlay();
|
|
25058
|
-
},
|
|
25059
|
-
onDragCancel: clearOverlay,
|
|
25060
|
-
children: [
|
|
25061
|
-
children,
|
|
25062
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25063
|
-
]
|
|
25064
|
-
}
|
|
25065
|
-
) });
|
|
25047
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
25066
25048
|
}
|
|
25067
25049
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
25068
25050
|
if (isRoot) {
|
|
25069
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25070
|
-
DndContext,
|
|
25071
|
-
{
|
|
25072
|
-
sensors,
|
|
25073
|
-
collisionDetection,
|
|
25074
|
-
onDragEnd: (e) => {
|
|
25075
|
-
handleDragEnd(e);
|
|
25076
|
-
clearOverlay();
|
|
25077
|
-
},
|
|
25078
|
-
onDragCancel: clearOverlay,
|
|
25079
|
-
children: [
|
|
25080
|
-
inner,
|
|
25081
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25082
|
-
]
|
|
25083
|
-
}
|
|
25084
|
-
) });
|
|
25051
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
25085
25052
|
}
|
|
25086
25053
|
return inner;
|
|
25087
25054
|
},
|
|
25088
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
25055
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25089
25056
|
);
|
|
25090
25057
|
return {
|
|
25091
25058
|
enabled,
|
|
@@ -20095,12 +20095,17 @@ function useDataDnd(args) {
|
|
|
20095
20095
|
React75__namespace.default.useEffect(() => {
|
|
20096
20096
|
setLocalOrder(null);
|
|
20097
20097
|
}, [items]);
|
|
20098
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
20099
|
+
const raw = it[dndItemIdField];
|
|
20100
|
+
return String(raw ?? `__idx_${idx}`);
|
|
20101
|
+
}).join("|");
|
|
20098
20102
|
const itemIds = React75__namespace.default.useMemo(
|
|
20099
20103
|
() => orderedItems.map((it, idx) => {
|
|
20100
20104
|
const raw = it[dndItemIdField];
|
|
20101
20105
|
return raw ?? `__idx_${idx}`;
|
|
20102
20106
|
}),
|
|
20103
|
-
|
|
20107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20108
|
+
[itemIdsSignature]
|
|
20104
20109
|
);
|
|
20105
20110
|
const zonesRef = React75__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
20106
20111
|
const registerZone = React75__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -20109,10 +20114,6 @@ function useDataDnd(args) {
|
|
|
20109
20114
|
const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
|
|
20110
20115
|
zonesRef.current.delete(zoneId2);
|
|
20111
20116
|
}, []);
|
|
20112
|
-
const [overlayNode, setOverlayNode] = React75__namespace.default.useState(null);
|
|
20113
|
-
const setOverlay = React75__namespace.default.useCallback((node) => {
|
|
20114
|
-
setOverlayNode(node);
|
|
20115
|
-
}, []);
|
|
20116
20117
|
const zoneId = React75__namespace.default.useId();
|
|
20117
20118
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20118
20119
|
const meta = React75__namespace.default.useMemo(
|
|
@@ -20196,7 +20197,7 @@ function useDataDnd(args) {
|
|
|
20196
20197
|
},
|
|
20197
20198
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20198
20199
|
);
|
|
20199
|
-
const
|
|
20200
|
+
const sortableData = React75__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
20200
20201
|
const SortableItem = React75__namespace.default.useCallback(
|
|
20201
20202
|
({ id, children }) => {
|
|
20202
20203
|
const {
|
|
@@ -20206,19 +20207,16 @@ function useDataDnd(args) {
|
|
|
20206
20207
|
transform,
|
|
20207
20208
|
transition,
|
|
20208
20209
|
isDragging
|
|
20209
|
-
} = sortable.useSortable({ id, data:
|
|
20210
|
-
const childrenRef = React75__namespace.default.useRef(children);
|
|
20211
|
-
childrenRef.current = children;
|
|
20212
|
-
React75__namespace.default.useEffect(() => {
|
|
20213
|
-
if (!isDragging || !overlaySink) return;
|
|
20214
|
-
overlaySink(childrenRef.current);
|
|
20215
|
-
return () => overlaySink(null);
|
|
20216
|
-
}, [isDragging]);
|
|
20210
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
20217
20211
|
const style = {
|
|
20218
20212
|
transform: utilities.CSS.Transform.toString(transform),
|
|
20219
20213
|
transition,
|
|
20220
20214
|
opacity: isDragging ? 0.4 : 1,
|
|
20221
|
-
cursor: enabled ? "grab" : void 0
|
|
20215
|
+
cursor: enabled ? "grab" : void 0,
|
|
20216
|
+
// Lift the dragged element above siblings so its visual movement
|
|
20217
|
+
// isn't hidden behind other cards / column boundaries.
|
|
20218
|
+
zIndex: isDragging ? 50 : void 0,
|
|
20219
|
+
position: isDragging ? "relative" : void 0
|
|
20222
20220
|
};
|
|
20223
20221
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20224
20222
|
exports.Box,
|
|
@@ -20232,12 +20230,12 @@ function useDataDnd(args) {
|
|
|
20232
20230
|
}
|
|
20233
20231
|
);
|
|
20234
20232
|
},
|
|
20235
|
-
[
|
|
20233
|
+
[sortableData, enabled]
|
|
20236
20234
|
);
|
|
20237
20235
|
const DropZoneShell = ({ children }) => {
|
|
20238
20236
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
20239
20237
|
id: `dnd-zone-${zoneId}`,
|
|
20240
|
-
data:
|
|
20238
|
+
data: sortableData
|
|
20241
20239
|
});
|
|
20242
20240
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20243
20241
|
exports.Box,
|
|
@@ -20250,55 +20248,24 @@ function useDataDnd(args) {
|
|
|
20250
20248
|
);
|
|
20251
20249
|
};
|
|
20252
20250
|
const rootContextValue = React75__namespace.default.useMemo(
|
|
20253
|
-
() => ({ registerZone, unregisterZone
|
|
20254
|
-
[registerZone, unregisterZone
|
|
20251
|
+
() => ({ registerZone, unregisterZone }),
|
|
20252
|
+
[registerZone, unregisterZone]
|
|
20255
20253
|
);
|
|
20256
20254
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20257
20255
|
(children) => {
|
|
20258
20256
|
if (!enabled) return children;
|
|
20259
20257
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
20260
|
-
const clearOverlay = () => setOverlay(null);
|
|
20261
20258
|
if (!isZone) {
|
|
20262
20259
|
if (!isRoot) return children;
|
|
20263
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20264
|
-
core$1.DndContext,
|
|
20265
|
-
{
|
|
20266
|
-
sensors,
|
|
20267
|
-
collisionDetection,
|
|
20268
|
-
onDragEnd: (e) => {
|
|
20269
|
-
handleDragEnd(e);
|
|
20270
|
-
clearOverlay();
|
|
20271
|
-
},
|
|
20272
|
-
onDragCancel: clearOverlay,
|
|
20273
|
-
children: [
|
|
20274
|
-
children,
|
|
20275
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20276
|
-
]
|
|
20277
|
-
}
|
|
20278
|
-
) });
|
|
20260
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
20279
20261
|
}
|
|
20280
20262
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
20281
20263
|
if (isRoot) {
|
|
20282
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20283
|
-
core$1.DndContext,
|
|
20284
|
-
{
|
|
20285
|
-
sensors,
|
|
20286
|
-
collisionDetection,
|
|
20287
|
-
onDragEnd: (e) => {
|
|
20288
|
-
handleDragEnd(e);
|
|
20289
|
-
clearOverlay();
|
|
20290
|
-
},
|
|
20291
|
-
onDragCancel: clearOverlay,
|
|
20292
|
-
children: [
|
|
20293
|
-
inner,
|
|
20294
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20295
|
-
]
|
|
20296
|
-
}
|
|
20297
|
-
) });
|
|
20264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
20298
20265
|
}
|
|
20299
20266
|
return inner;
|
|
20300
20267
|
},
|
|
20301
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
20268
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20302
20269
|
);
|
|
20303
20270
|
return {
|
|
20304
20271
|
enabled,
|
package/dist/components/index.js
CHANGED
|
@@ -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,
|
|
38
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -20049,12 +20049,17 @@ function useDataDnd(args) {
|
|
|
20049
20049
|
React75__default.useEffect(() => {
|
|
20050
20050
|
setLocalOrder(null);
|
|
20051
20051
|
}, [items]);
|
|
20052
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
20053
|
+
const raw = it[dndItemIdField];
|
|
20054
|
+
return String(raw ?? `__idx_${idx}`);
|
|
20055
|
+
}).join("|");
|
|
20052
20056
|
const itemIds = React75__default.useMemo(
|
|
20053
20057
|
() => orderedItems.map((it, idx) => {
|
|
20054
20058
|
const raw = it[dndItemIdField];
|
|
20055
20059
|
return raw ?? `__idx_${idx}`;
|
|
20056
20060
|
}),
|
|
20057
|
-
|
|
20061
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20062
|
+
[itemIdsSignature]
|
|
20058
20063
|
);
|
|
20059
20064
|
const zonesRef = React75__default.useRef(/* @__PURE__ */ new Map());
|
|
20060
20065
|
const registerZone = React75__default.useCallback((zoneId2, meta2) => {
|
|
@@ -20063,10 +20068,6 @@ function useDataDnd(args) {
|
|
|
20063
20068
|
const unregisterZone = React75__default.useCallback((zoneId2) => {
|
|
20064
20069
|
zonesRef.current.delete(zoneId2);
|
|
20065
20070
|
}, []);
|
|
20066
|
-
const [overlayNode, setOverlayNode] = React75__default.useState(null);
|
|
20067
|
-
const setOverlay = React75__default.useCallback((node) => {
|
|
20068
|
-
setOverlayNode(node);
|
|
20069
|
-
}, []);
|
|
20070
20071
|
const zoneId = React75__default.useId();
|
|
20071
20072
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20072
20073
|
const meta = React75__default.useMemo(
|
|
@@ -20150,7 +20151,7 @@ function useDataDnd(args) {
|
|
|
20150
20151
|
},
|
|
20151
20152
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20152
20153
|
);
|
|
20153
|
-
const
|
|
20154
|
+
const sortableData = React75__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
20154
20155
|
const SortableItem = React75__default.useCallback(
|
|
20155
20156
|
({ id, children }) => {
|
|
20156
20157
|
const {
|
|
@@ -20160,19 +20161,16 @@ function useDataDnd(args) {
|
|
|
20160
20161
|
transform,
|
|
20161
20162
|
transition,
|
|
20162
20163
|
isDragging
|
|
20163
|
-
} = useSortable({ id, data:
|
|
20164
|
-
const childrenRef = React75__default.useRef(children);
|
|
20165
|
-
childrenRef.current = children;
|
|
20166
|
-
React75__default.useEffect(() => {
|
|
20167
|
-
if (!isDragging || !overlaySink) return;
|
|
20168
|
-
overlaySink(childrenRef.current);
|
|
20169
|
-
return () => overlaySink(null);
|
|
20170
|
-
}, [isDragging]);
|
|
20164
|
+
} = useSortable({ id, data: sortableData });
|
|
20171
20165
|
const style = {
|
|
20172
20166
|
transform: CSS.Transform.toString(transform),
|
|
20173
20167
|
transition,
|
|
20174
20168
|
opacity: isDragging ? 0.4 : 1,
|
|
20175
|
-
cursor: enabled ? "grab" : void 0
|
|
20169
|
+
cursor: enabled ? "grab" : void 0,
|
|
20170
|
+
// Lift the dragged element above siblings so its visual movement
|
|
20171
|
+
// isn't hidden behind other cards / column boundaries.
|
|
20172
|
+
zIndex: isDragging ? 50 : void 0,
|
|
20173
|
+
position: isDragging ? "relative" : void 0
|
|
20176
20174
|
};
|
|
20177
20175
|
return /* @__PURE__ */ jsx(
|
|
20178
20176
|
Box,
|
|
@@ -20186,12 +20184,12 @@ function useDataDnd(args) {
|
|
|
20186
20184
|
}
|
|
20187
20185
|
);
|
|
20188
20186
|
},
|
|
20189
|
-
[
|
|
20187
|
+
[sortableData, enabled]
|
|
20190
20188
|
);
|
|
20191
20189
|
const DropZoneShell = ({ children }) => {
|
|
20192
20190
|
const { setNodeRef, isOver } = useDroppable({
|
|
20193
20191
|
id: `dnd-zone-${zoneId}`,
|
|
20194
|
-
data:
|
|
20192
|
+
data: sortableData
|
|
20195
20193
|
});
|
|
20196
20194
|
return /* @__PURE__ */ jsx(
|
|
20197
20195
|
Box,
|
|
@@ -20204,55 +20202,24 @@ function useDataDnd(args) {
|
|
|
20204
20202
|
);
|
|
20205
20203
|
};
|
|
20206
20204
|
const rootContextValue = React75__default.useMemo(
|
|
20207
|
-
() => ({ registerZone, unregisterZone
|
|
20208
|
-
[registerZone, unregisterZone
|
|
20205
|
+
() => ({ registerZone, unregisterZone }),
|
|
20206
|
+
[registerZone, unregisterZone]
|
|
20209
20207
|
);
|
|
20210
20208
|
const wrapContainer = React75__default.useCallback(
|
|
20211
20209
|
(children) => {
|
|
20212
20210
|
if (!enabled) return children;
|
|
20213
20211
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
20214
|
-
const clearOverlay = () => setOverlay(null);
|
|
20215
20212
|
if (!isZone) {
|
|
20216
20213
|
if (!isRoot) return children;
|
|
20217
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20218
|
-
DndContext,
|
|
20219
|
-
{
|
|
20220
|
-
sensors,
|
|
20221
|
-
collisionDetection,
|
|
20222
|
-
onDragEnd: (e) => {
|
|
20223
|
-
handleDragEnd(e);
|
|
20224
|
-
clearOverlay();
|
|
20225
|
-
},
|
|
20226
|
-
onDragCancel: clearOverlay,
|
|
20227
|
-
children: [
|
|
20228
|
-
children,
|
|
20229
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20230
|
-
]
|
|
20231
|
-
}
|
|
20232
|
-
) });
|
|
20214
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
20233
20215
|
}
|
|
20234
20216
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
20235
20217
|
if (isRoot) {
|
|
20236
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20237
|
-
DndContext,
|
|
20238
|
-
{
|
|
20239
|
-
sensors,
|
|
20240
|
-
collisionDetection,
|
|
20241
|
-
onDragEnd: (e) => {
|
|
20242
|
-
handleDragEnd(e);
|
|
20243
|
-
clearOverlay();
|
|
20244
|
-
},
|
|
20245
|
-
onDragCancel: clearOverlay,
|
|
20246
|
-
children: [
|
|
20247
|
-
inner,
|
|
20248
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20249
|
-
]
|
|
20250
|
-
}
|
|
20251
|
-
) });
|
|
20218
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
20252
20219
|
}
|
|
20253
20220
|
return inner;
|
|
20254
20221
|
},
|
|
20255
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
20222
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20256
20223
|
);
|
|
20257
20224
|
return {
|
|
20258
20225
|
enabled,
|
package/dist/providers/index.cjs
CHANGED
|
@@ -21340,12 +21340,17 @@ function useDataDnd(args) {
|
|
|
21340
21340
|
React81__namespace.default.useEffect(() => {
|
|
21341
21341
|
setLocalOrder(null);
|
|
21342
21342
|
}, [items]);
|
|
21343
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21344
|
+
const raw = it[dndItemIdField];
|
|
21345
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21346
|
+
}).join("|");
|
|
21343
21347
|
const itemIds = React81__namespace.default.useMemo(
|
|
21344
21348
|
() => orderedItems.map((it, idx) => {
|
|
21345
21349
|
const raw = it[dndItemIdField];
|
|
21346
21350
|
return raw ?? `__idx_${idx}`;
|
|
21347
21351
|
}),
|
|
21348
|
-
|
|
21352
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21353
|
+
[itemIdsSignature]
|
|
21349
21354
|
);
|
|
21350
21355
|
const zonesRef = React81__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
21351
21356
|
const registerZone = React81__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -21354,10 +21359,6 @@ function useDataDnd(args) {
|
|
|
21354
21359
|
const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
|
|
21355
21360
|
zonesRef.current.delete(zoneId2);
|
|
21356
21361
|
}, []);
|
|
21357
|
-
const [overlayNode, setOverlayNode] = React81__namespace.default.useState(null);
|
|
21358
|
-
const setOverlay = React81__namespace.default.useCallback((node) => {
|
|
21359
|
-
setOverlayNode(node);
|
|
21360
|
-
}, []);
|
|
21361
21362
|
const zoneId = React81__namespace.default.useId();
|
|
21362
21363
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21363
21364
|
const meta = React81__namespace.default.useMemo(
|
|
@@ -21441,7 +21442,7 @@ function useDataDnd(args) {
|
|
|
21441
21442
|
},
|
|
21442
21443
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21443
21444
|
);
|
|
21444
|
-
const
|
|
21445
|
+
const sortableData = React81__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21445
21446
|
const SortableItem = React81__namespace.default.useCallback(
|
|
21446
21447
|
({ id, children }) => {
|
|
21447
21448
|
const {
|
|
@@ -21451,19 +21452,16 @@ function useDataDnd(args) {
|
|
|
21451
21452
|
transform,
|
|
21452
21453
|
transition,
|
|
21453
21454
|
isDragging
|
|
21454
|
-
} = sortable.useSortable({ id, data:
|
|
21455
|
-
const childrenRef = React81__namespace.default.useRef(children);
|
|
21456
|
-
childrenRef.current = children;
|
|
21457
|
-
React81__namespace.default.useEffect(() => {
|
|
21458
|
-
if (!isDragging || !overlaySink) return;
|
|
21459
|
-
overlaySink(childrenRef.current);
|
|
21460
|
-
return () => overlaySink(null);
|
|
21461
|
-
}, [isDragging]);
|
|
21455
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
21462
21456
|
const style = {
|
|
21463
21457
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21464
21458
|
transition,
|
|
21465
21459
|
opacity: isDragging ? 0.4 : 1,
|
|
21466
|
-
cursor: enabled ? "grab" : void 0
|
|
21460
|
+
cursor: enabled ? "grab" : void 0,
|
|
21461
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21462
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21463
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21464
|
+
position: isDragging ? "relative" : void 0
|
|
21467
21465
|
};
|
|
21468
21466
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21469
21467
|
Box,
|
|
@@ -21477,12 +21475,12 @@ function useDataDnd(args) {
|
|
|
21477
21475
|
}
|
|
21478
21476
|
);
|
|
21479
21477
|
},
|
|
21480
|
-
[
|
|
21478
|
+
[sortableData, enabled]
|
|
21481
21479
|
);
|
|
21482
21480
|
const DropZoneShell = ({ children }) => {
|
|
21483
21481
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21484
21482
|
id: `dnd-zone-${zoneId}`,
|
|
21485
|
-
data:
|
|
21483
|
+
data: sortableData
|
|
21486
21484
|
});
|
|
21487
21485
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21488
21486
|
Box,
|
|
@@ -21495,55 +21493,24 @@ function useDataDnd(args) {
|
|
|
21495
21493
|
);
|
|
21496
21494
|
};
|
|
21497
21495
|
const rootContextValue = React81__namespace.default.useMemo(
|
|
21498
|
-
() => ({ registerZone, unregisterZone
|
|
21499
|
-
[registerZone, unregisterZone
|
|
21496
|
+
() => ({ registerZone, unregisterZone }),
|
|
21497
|
+
[registerZone, unregisterZone]
|
|
21500
21498
|
);
|
|
21501
21499
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21502
21500
|
(children) => {
|
|
21503
21501
|
if (!enabled) return children;
|
|
21504
21502
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21505
|
-
const clearOverlay = () => setOverlay(null);
|
|
21506
21503
|
if (!isZone) {
|
|
21507
21504
|
if (!isRoot) return children;
|
|
21508
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21509
|
-
core$1.DndContext,
|
|
21510
|
-
{
|
|
21511
|
-
sensors,
|
|
21512
|
-
collisionDetection,
|
|
21513
|
-
onDragEnd: (e) => {
|
|
21514
|
-
handleDragEnd(e);
|
|
21515
|
-
clearOverlay();
|
|
21516
|
-
},
|
|
21517
|
-
onDragCancel: clearOverlay,
|
|
21518
|
-
children: [
|
|
21519
|
-
children,
|
|
21520
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21521
|
-
]
|
|
21522
|
-
}
|
|
21523
|
-
) });
|
|
21505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21524
21506
|
}
|
|
21525
21507
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21526
21508
|
if (isRoot) {
|
|
21527
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21528
|
-
core$1.DndContext,
|
|
21529
|
-
{
|
|
21530
|
-
sensors,
|
|
21531
|
-
collisionDetection,
|
|
21532
|
-
onDragEnd: (e) => {
|
|
21533
|
-
handleDragEnd(e);
|
|
21534
|
-
clearOverlay();
|
|
21535
|
-
},
|
|
21536
|
-
onDragCancel: clearOverlay,
|
|
21537
|
-
children: [
|
|
21538
|
-
inner,
|
|
21539
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21540
|
-
]
|
|
21541
|
-
}
|
|
21542
|
-
) });
|
|
21509
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21543
21510
|
}
|
|
21544
21511
|
return inner;
|
|
21545
21512
|
},
|
|
21546
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21513
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21547
21514
|
);
|
|
21548
21515
|
return {
|
|
21549
21516
|
enabled,
|
package/dist/providers/index.js
CHANGED
|
@@ -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,
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -21294,12 +21294,17 @@ function useDataDnd(args) {
|
|
|
21294
21294
|
React81__default.useEffect(() => {
|
|
21295
21295
|
setLocalOrder(null);
|
|
21296
21296
|
}, [items]);
|
|
21297
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21298
|
+
const raw = it[dndItemIdField];
|
|
21299
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21300
|
+
}).join("|");
|
|
21297
21301
|
const itemIds = React81__default.useMemo(
|
|
21298
21302
|
() => orderedItems.map((it, idx) => {
|
|
21299
21303
|
const raw = it[dndItemIdField];
|
|
21300
21304
|
return raw ?? `__idx_${idx}`;
|
|
21301
21305
|
}),
|
|
21302
|
-
|
|
21306
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21307
|
+
[itemIdsSignature]
|
|
21303
21308
|
);
|
|
21304
21309
|
const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
|
|
21305
21310
|
const registerZone = React81__default.useCallback((zoneId2, meta2) => {
|
|
@@ -21308,10 +21313,6 @@ function useDataDnd(args) {
|
|
|
21308
21313
|
const unregisterZone = React81__default.useCallback((zoneId2) => {
|
|
21309
21314
|
zonesRef.current.delete(zoneId2);
|
|
21310
21315
|
}, []);
|
|
21311
|
-
const [overlayNode, setOverlayNode] = React81__default.useState(null);
|
|
21312
|
-
const setOverlay = React81__default.useCallback((node) => {
|
|
21313
|
-
setOverlayNode(node);
|
|
21314
|
-
}, []);
|
|
21315
21316
|
const zoneId = React81__default.useId();
|
|
21316
21317
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21317
21318
|
const meta = React81__default.useMemo(
|
|
@@ -21395,7 +21396,7 @@ function useDataDnd(args) {
|
|
|
21395
21396
|
},
|
|
21396
21397
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21397
21398
|
);
|
|
21398
|
-
const
|
|
21399
|
+
const sortableData = React81__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21399
21400
|
const SortableItem = React81__default.useCallback(
|
|
21400
21401
|
({ id, children }) => {
|
|
21401
21402
|
const {
|
|
@@ -21405,19 +21406,16 @@ function useDataDnd(args) {
|
|
|
21405
21406
|
transform,
|
|
21406
21407
|
transition,
|
|
21407
21408
|
isDragging
|
|
21408
|
-
} = useSortable({ id, data:
|
|
21409
|
-
const childrenRef = React81__default.useRef(children);
|
|
21410
|
-
childrenRef.current = children;
|
|
21411
|
-
React81__default.useEffect(() => {
|
|
21412
|
-
if (!isDragging || !overlaySink) return;
|
|
21413
|
-
overlaySink(childrenRef.current);
|
|
21414
|
-
return () => overlaySink(null);
|
|
21415
|
-
}, [isDragging]);
|
|
21409
|
+
} = useSortable({ id, data: sortableData });
|
|
21416
21410
|
const style = {
|
|
21417
21411
|
transform: CSS.Transform.toString(transform),
|
|
21418
21412
|
transition,
|
|
21419
21413
|
opacity: isDragging ? 0.4 : 1,
|
|
21420
|
-
cursor: enabled ? "grab" : void 0
|
|
21414
|
+
cursor: enabled ? "grab" : void 0,
|
|
21415
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21416
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21417
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21418
|
+
position: isDragging ? "relative" : void 0
|
|
21421
21419
|
};
|
|
21422
21420
|
return /* @__PURE__ */ jsx(
|
|
21423
21421
|
Box,
|
|
@@ -21431,12 +21429,12 @@ function useDataDnd(args) {
|
|
|
21431
21429
|
}
|
|
21432
21430
|
);
|
|
21433
21431
|
},
|
|
21434
|
-
[
|
|
21432
|
+
[sortableData, enabled]
|
|
21435
21433
|
);
|
|
21436
21434
|
const DropZoneShell = ({ children }) => {
|
|
21437
21435
|
const { setNodeRef, isOver } = useDroppable({
|
|
21438
21436
|
id: `dnd-zone-${zoneId}`,
|
|
21439
|
-
data:
|
|
21437
|
+
data: sortableData
|
|
21440
21438
|
});
|
|
21441
21439
|
return /* @__PURE__ */ jsx(
|
|
21442
21440
|
Box,
|
|
@@ -21449,55 +21447,24 @@ function useDataDnd(args) {
|
|
|
21449
21447
|
);
|
|
21450
21448
|
};
|
|
21451
21449
|
const rootContextValue = React81__default.useMemo(
|
|
21452
|
-
() => ({ registerZone, unregisterZone
|
|
21453
|
-
[registerZone, unregisterZone
|
|
21450
|
+
() => ({ registerZone, unregisterZone }),
|
|
21451
|
+
[registerZone, unregisterZone]
|
|
21454
21452
|
);
|
|
21455
21453
|
const wrapContainer = React81__default.useCallback(
|
|
21456
21454
|
(children) => {
|
|
21457
21455
|
if (!enabled) return children;
|
|
21458
21456
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21459
|
-
const clearOverlay = () => setOverlay(null);
|
|
21460
21457
|
if (!isZone) {
|
|
21461
21458
|
if (!isRoot) return children;
|
|
21462
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21463
|
-
DndContext,
|
|
21464
|
-
{
|
|
21465
|
-
sensors,
|
|
21466
|
-
collisionDetection,
|
|
21467
|
-
onDragEnd: (e) => {
|
|
21468
|
-
handleDragEnd(e);
|
|
21469
|
-
clearOverlay();
|
|
21470
|
-
},
|
|
21471
|
-
onDragCancel: clearOverlay,
|
|
21472
|
-
children: [
|
|
21473
|
-
children,
|
|
21474
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21475
|
-
]
|
|
21476
|
-
}
|
|
21477
|
-
) });
|
|
21459
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21478
21460
|
}
|
|
21479
21461
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21480
21462
|
if (isRoot) {
|
|
21481
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21482
|
-
DndContext,
|
|
21483
|
-
{
|
|
21484
|
-
sensors,
|
|
21485
|
-
collisionDetection,
|
|
21486
|
-
onDragEnd: (e) => {
|
|
21487
|
-
handleDragEnd(e);
|
|
21488
|
-
clearOverlay();
|
|
21489
|
-
},
|
|
21490
|
-
onDragCancel: clearOverlay,
|
|
21491
|
-
children: [
|
|
21492
|
-
inner,
|
|
21493
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21494
|
-
]
|
|
21495
|
-
}
|
|
21496
|
-
) });
|
|
21463
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21497
21464
|
}
|
|
21498
21465
|
return inner;
|
|
21499
21466
|
},
|
|
21500
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21467
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21501
21468
|
);
|
|
21502
21469
|
return {
|
|
21503
21470
|
enabled,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -21109,12 +21109,17 @@ function useDataDnd(args) {
|
|
|
21109
21109
|
React80__namespace.default.useEffect(() => {
|
|
21110
21110
|
setLocalOrder(null);
|
|
21111
21111
|
}, [items]);
|
|
21112
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21113
|
+
const raw = it[dndItemIdField];
|
|
21114
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21115
|
+
}).join("|");
|
|
21112
21116
|
const itemIds = React80__namespace.default.useMemo(
|
|
21113
21117
|
() => orderedItems.map((it, idx) => {
|
|
21114
21118
|
const raw = it[dndItemIdField];
|
|
21115
21119
|
return raw ?? `__idx_${idx}`;
|
|
21116
21120
|
}),
|
|
21117
|
-
|
|
21121
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21122
|
+
[itemIdsSignature]
|
|
21118
21123
|
);
|
|
21119
21124
|
const zonesRef = React80__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
21120
21125
|
const registerZone = React80__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -21123,10 +21128,6 @@ function useDataDnd(args) {
|
|
|
21123
21128
|
const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
|
|
21124
21129
|
zonesRef.current.delete(zoneId2);
|
|
21125
21130
|
}, []);
|
|
21126
|
-
const [overlayNode, setOverlayNode] = React80__namespace.default.useState(null);
|
|
21127
|
-
const setOverlay = React80__namespace.default.useCallback((node) => {
|
|
21128
|
-
setOverlayNode(node);
|
|
21129
|
-
}, []);
|
|
21130
21131
|
const zoneId = React80__namespace.default.useId();
|
|
21131
21132
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21132
21133
|
const meta = React80__namespace.default.useMemo(
|
|
@@ -21210,7 +21211,7 @@ function useDataDnd(args) {
|
|
|
21210
21211
|
},
|
|
21211
21212
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21212
21213
|
);
|
|
21213
|
-
const
|
|
21214
|
+
const sortableData = React80__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21214
21215
|
const SortableItem = React80__namespace.default.useCallback(
|
|
21215
21216
|
({ id, children }) => {
|
|
21216
21217
|
const {
|
|
@@ -21220,19 +21221,16 @@ function useDataDnd(args) {
|
|
|
21220
21221
|
transform,
|
|
21221
21222
|
transition,
|
|
21222
21223
|
isDragging
|
|
21223
|
-
} = sortable.useSortable({ id, data:
|
|
21224
|
-
const childrenRef = React80__namespace.default.useRef(children);
|
|
21225
|
-
childrenRef.current = children;
|
|
21226
|
-
React80__namespace.default.useEffect(() => {
|
|
21227
|
-
if (!isDragging || !overlaySink) return;
|
|
21228
|
-
overlaySink(childrenRef.current);
|
|
21229
|
-
return () => overlaySink(null);
|
|
21230
|
-
}, [isDragging]);
|
|
21224
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
21231
21225
|
const style = {
|
|
21232
21226
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21233
21227
|
transition,
|
|
21234
21228
|
opacity: isDragging ? 0.4 : 1,
|
|
21235
|
-
cursor: enabled ? "grab" : void 0
|
|
21229
|
+
cursor: enabled ? "grab" : void 0,
|
|
21230
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21231
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21232
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21233
|
+
position: isDragging ? "relative" : void 0
|
|
21236
21234
|
};
|
|
21237
21235
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21238
21236
|
Box,
|
|
@@ -21246,12 +21244,12 @@ function useDataDnd(args) {
|
|
|
21246
21244
|
}
|
|
21247
21245
|
);
|
|
21248
21246
|
},
|
|
21249
|
-
[
|
|
21247
|
+
[sortableData, enabled]
|
|
21250
21248
|
);
|
|
21251
21249
|
const DropZoneShell = ({ children }) => {
|
|
21252
21250
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21253
21251
|
id: `dnd-zone-${zoneId}`,
|
|
21254
|
-
data:
|
|
21252
|
+
data: sortableData
|
|
21255
21253
|
});
|
|
21256
21254
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21257
21255
|
Box,
|
|
@@ -21264,55 +21262,24 @@ function useDataDnd(args) {
|
|
|
21264
21262
|
);
|
|
21265
21263
|
};
|
|
21266
21264
|
const rootContextValue = React80__namespace.default.useMemo(
|
|
21267
|
-
() => ({ registerZone, unregisterZone
|
|
21268
|
-
[registerZone, unregisterZone
|
|
21265
|
+
() => ({ registerZone, unregisterZone }),
|
|
21266
|
+
[registerZone, unregisterZone]
|
|
21269
21267
|
);
|
|
21270
21268
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21271
21269
|
(children) => {
|
|
21272
21270
|
if (!enabled) return children;
|
|
21273
21271
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21274
|
-
const clearOverlay = () => setOverlay(null);
|
|
21275
21272
|
if (!isZone) {
|
|
21276
21273
|
if (!isRoot) return children;
|
|
21277
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21278
|
-
core$1.DndContext,
|
|
21279
|
-
{
|
|
21280
|
-
sensors,
|
|
21281
|
-
collisionDetection,
|
|
21282
|
-
onDragEnd: (e) => {
|
|
21283
|
-
handleDragEnd(e);
|
|
21284
|
-
clearOverlay();
|
|
21285
|
-
},
|
|
21286
|
-
onDragCancel: clearOverlay,
|
|
21287
|
-
children: [
|
|
21288
|
-
children,
|
|
21289
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21290
|
-
]
|
|
21291
|
-
}
|
|
21292
|
-
) });
|
|
21274
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21293
21275
|
}
|
|
21294
21276
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21295
21277
|
if (isRoot) {
|
|
21296
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21297
|
-
core$1.DndContext,
|
|
21298
|
-
{
|
|
21299
|
-
sensors,
|
|
21300
|
-
collisionDetection,
|
|
21301
|
-
onDragEnd: (e) => {
|
|
21302
|
-
handleDragEnd(e);
|
|
21303
|
-
clearOverlay();
|
|
21304
|
-
},
|
|
21305
|
-
onDragCancel: clearOverlay,
|
|
21306
|
-
children: [
|
|
21307
|
-
inner,
|
|
21308
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21309
|
-
]
|
|
21310
|
-
}
|
|
21311
|
-
) });
|
|
21278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21312
21279
|
}
|
|
21313
21280
|
return inner;
|
|
21314
21281
|
},
|
|
21315
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21282
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21316
21283
|
);
|
|
21317
21284
|
return {
|
|
21318
21285
|
enabled,
|
package/dist/runtime/index.js
CHANGED
|
@@ -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,
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -21063,12 +21063,17 @@ function useDataDnd(args) {
|
|
|
21063
21063
|
React80__default.useEffect(() => {
|
|
21064
21064
|
setLocalOrder(null);
|
|
21065
21065
|
}, [items]);
|
|
21066
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21067
|
+
const raw = it[dndItemIdField];
|
|
21068
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21069
|
+
}).join("|");
|
|
21066
21070
|
const itemIds = React80__default.useMemo(
|
|
21067
21071
|
() => orderedItems.map((it, idx) => {
|
|
21068
21072
|
const raw = it[dndItemIdField];
|
|
21069
21073
|
return raw ?? `__idx_${idx}`;
|
|
21070
21074
|
}),
|
|
21071
|
-
|
|
21075
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21076
|
+
[itemIdsSignature]
|
|
21072
21077
|
);
|
|
21073
21078
|
const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
|
|
21074
21079
|
const registerZone = React80__default.useCallback((zoneId2, meta2) => {
|
|
@@ -21077,10 +21082,6 @@ function useDataDnd(args) {
|
|
|
21077
21082
|
const unregisterZone = React80__default.useCallback((zoneId2) => {
|
|
21078
21083
|
zonesRef.current.delete(zoneId2);
|
|
21079
21084
|
}, []);
|
|
21080
|
-
const [overlayNode, setOverlayNode] = React80__default.useState(null);
|
|
21081
|
-
const setOverlay = React80__default.useCallback((node) => {
|
|
21082
|
-
setOverlayNode(node);
|
|
21083
|
-
}, []);
|
|
21084
21085
|
const zoneId = React80__default.useId();
|
|
21085
21086
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21086
21087
|
const meta = React80__default.useMemo(
|
|
@@ -21164,7 +21165,7 @@ function useDataDnd(args) {
|
|
|
21164
21165
|
},
|
|
21165
21166
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21166
21167
|
);
|
|
21167
|
-
const
|
|
21168
|
+
const sortableData = React80__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21168
21169
|
const SortableItem = React80__default.useCallback(
|
|
21169
21170
|
({ id, children }) => {
|
|
21170
21171
|
const {
|
|
@@ -21174,19 +21175,16 @@ function useDataDnd(args) {
|
|
|
21174
21175
|
transform,
|
|
21175
21176
|
transition,
|
|
21176
21177
|
isDragging
|
|
21177
|
-
} = useSortable({ id, data:
|
|
21178
|
-
const childrenRef = React80__default.useRef(children);
|
|
21179
|
-
childrenRef.current = children;
|
|
21180
|
-
React80__default.useEffect(() => {
|
|
21181
|
-
if (!isDragging || !overlaySink) return;
|
|
21182
|
-
overlaySink(childrenRef.current);
|
|
21183
|
-
return () => overlaySink(null);
|
|
21184
|
-
}, [isDragging]);
|
|
21178
|
+
} = useSortable({ id, data: sortableData });
|
|
21185
21179
|
const style = {
|
|
21186
21180
|
transform: CSS.Transform.toString(transform),
|
|
21187
21181
|
transition,
|
|
21188
21182
|
opacity: isDragging ? 0.4 : 1,
|
|
21189
|
-
cursor: enabled ? "grab" : void 0
|
|
21183
|
+
cursor: enabled ? "grab" : void 0,
|
|
21184
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21185
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21186
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21187
|
+
position: isDragging ? "relative" : void 0
|
|
21190
21188
|
};
|
|
21191
21189
|
return /* @__PURE__ */ jsx(
|
|
21192
21190
|
Box,
|
|
@@ -21200,12 +21198,12 @@ function useDataDnd(args) {
|
|
|
21200
21198
|
}
|
|
21201
21199
|
);
|
|
21202
21200
|
},
|
|
21203
|
-
[
|
|
21201
|
+
[sortableData, enabled]
|
|
21204
21202
|
);
|
|
21205
21203
|
const DropZoneShell = ({ children }) => {
|
|
21206
21204
|
const { setNodeRef, isOver } = useDroppable({
|
|
21207
21205
|
id: `dnd-zone-${zoneId}`,
|
|
21208
|
-
data:
|
|
21206
|
+
data: sortableData
|
|
21209
21207
|
});
|
|
21210
21208
|
return /* @__PURE__ */ jsx(
|
|
21211
21209
|
Box,
|
|
@@ -21218,55 +21216,24 @@ function useDataDnd(args) {
|
|
|
21218
21216
|
);
|
|
21219
21217
|
};
|
|
21220
21218
|
const rootContextValue = React80__default.useMemo(
|
|
21221
|
-
() => ({ registerZone, unregisterZone
|
|
21222
|
-
[registerZone, unregisterZone
|
|
21219
|
+
() => ({ registerZone, unregisterZone }),
|
|
21220
|
+
[registerZone, unregisterZone]
|
|
21223
21221
|
);
|
|
21224
21222
|
const wrapContainer = React80__default.useCallback(
|
|
21225
21223
|
(children) => {
|
|
21226
21224
|
if (!enabled) return children;
|
|
21227
21225
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21228
|
-
const clearOverlay = () => setOverlay(null);
|
|
21229
21226
|
if (!isZone) {
|
|
21230
21227
|
if (!isRoot) return children;
|
|
21231
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21232
|
-
DndContext,
|
|
21233
|
-
{
|
|
21234
|
-
sensors,
|
|
21235
|
-
collisionDetection,
|
|
21236
|
-
onDragEnd: (e) => {
|
|
21237
|
-
handleDragEnd(e);
|
|
21238
|
-
clearOverlay();
|
|
21239
|
-
},
|
|
21240
|
-
onDragCancel: clearOverlay,
|
|
21241
|
-
children: [
|
|
21242
|
-
children,
|
|
21243
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21244
|
-
]
|
|
21245
|
-
}
|
|
21246
|
-
) });
|
|
21228
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21247
21229
|
}
|
|
21248
21230
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21249
21231
|
if (isRoot) {
|
|
21250
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21251
|
-
DndContext,
|
|
21252
|
-
{
|
|
21253
|
-
sensors,
|
|
21254
|
-
collisionDetection,
|
|
21255
|
-
onDragEnd: (e) => {
|
|
21256
|
-
handleDragEnd(e);
|
|
21257
|
-
clearOverlay();
|
|
21258
|
-
},
|
|
21259
|
-
onDragCancel: clearOverlay,
|
|
21260
|
-
children: [
|
|
21261
|
-
inner,
|
|
21262
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21263
|
-
]
|
|
21264
|
-
}
|
|
21265
|
-
) });
|
|
21232
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21266
21233
|
}
|
|
21267
21234
|
return inner;
|
|
21268
21235
|
},
|
|
21269
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21236
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21270
21237
|
);
|
|
21271
21238
|
return {
|
|
21272
21239
|
enabled,
|