@mapples/dnd 1.0.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.
Files changed (70) hide show
  1. package/README.md +390 -0
  2. package/dist/components/DnDRootView.d.ts +13 -0
  3. package/dist/components/DnDRootView.d.ts.map +1 -0
  4. package/dist/components/DnDRootView.js +98 -0
  5. package/dist/components/DnDRootView.js.map +1 -0
  6. package/dist/components/DropArea.d.ts +13 -0
  7. package/dist/components/DropArea.d.ts.map +1 -0
  8. package/dist/components/DropArea.js +16 -0
  9. package/dist/components/DropArea.js.map +1 -0
  10. package/dist/components/index.d.ts +3 -0
  11. package/dist/components/index.d.ts.map +1 -0
  12. package/dist/components/index.js +3 -0
  13. package/dist/components/index.js.map +1 -0
  14. package/dist/constants/index.d.ts +15 -0
  15. package/dist/constants/index.d.ts.map +1 -0
  16. package/dist/constants/index.js +16 -0
  17. package/dist/constants/index.js.map +1 -0
  18. package/dist/context/DnDContext.d.ts +14 -0
  19. package/dist/context/DnDContext.d.ts.map +1 -0
  20. package/dist/context/DnDContext.js +22 -0
  21. package/dist/context/DnDContext.js.map +1 -0
  22. package/dist/context/DropContext.d.ts +17 -0
  23. package/dist/context/DropContext.d.ts.map +1 -0
  24. package/dist/context/DropContext.js +16 -0
  25. package/dist/context/DropContext.js.map +1 -0
  26. package/dist/context/index.d.ts +5 -0
  27. package/dist/context/index.d.ts.map +1 -0
  28. package/dist/context/index.js +5 -0
  29. package/dist/context/index.js.map +1 -0
  30. package/dist/hooks/index.d.ts +5 -0
  31. package/dist/hooks/index.d.ts.map +1 -0
  32. package/dist/hooks/index.js +5 -0
  33. package/dist/hooks/index.js.map +1 -0
  34. package/dist/hooks/useDnD.d.ts +13 -0
  35. package/dist/hooks/useDnD.d.ts.map +1 -0
  36. package/dist/hooks/useDnD.js +16 -0
  37. package/dist/hooks/useDnD.js.map +1 -0
  38. package/dist/hooks/useDrag.d.ts +24 -0
  39. package/dist/hooks/useDrag.d.ts.map +1 -0
  40. package/dist/hooks/useDrag.js +74 -0
  41. package/dist/hooks/useDrag.js.map +1 -0
  42. package/dist/hooks/useDrop.d.ts +31 -0
  43. package/dist/hooks/useDrop.d.ts.map +1 -0
  44. package/dist/hooks/useDrop.js +108 -0
  45. package/dist/hooks/useDrop.js.map +1 -0
  46. package/dist/hooks/useDropContext.d.ts +12 -0
  47. package/dist/hooks/useDropContext.d.ts.map +1 -0
  48. package/dist/hooks/useDropContext.js +14 -0
  49. package/dist/hooks/useDropContext.js.map +1 -0
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +5 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/monitor/Monitor.d.ts +223 -0
  55. package/dist/monitor/Monitor.d.ts.map +1 -0
  56. package/dist/monitor/Monitor.js +573 -0
  57. package/dist/monitor/Monitor.js.map +1 -0
  58. package/dist/monitor/index.d.ts +3 -0
  59. package/dist/monitor/index.d.ts.map +1 -0
  60. package/dist/monitor/index.js +3 -0
  61. package/dist/monitor/index.js.map +1 -0
  62. package/dist/types/index.d.ts +208 -0
  63. package/dist/types/index.d.ts.map +1 -0
  64. package/dist/types/index.js +33 -0
  65. package/dist/types/index.js.map +1 -0
  66. package/dist/utils/index.d.ts +11 -0
  67. package/dist/utils/index.d.ts.map +1 -0
  68. package/dist/utils/index.js +13 -0
  69. package/dist/utils/index.js.map +1 -0
  70. package/package.json +62 -0
@@ -0,0 +1,208 @@
1
+ import { FC, PropsWithChildren, ReactElement } from 'react';
2
+ import { LayoutRectangle, ViewProps } from 'react-native';
3
+ import { SharedValue } from 'react-native-reanimated';
4
+ import { SvgProps } from 'react-native-svg';
5
+ import { Monitor } from '../monitor';
6
+ export { Monitor };
7
+ /**
8
+ * Enum representing the different types of drag and drop events.
9
+ * @public
10
+ */
11
+ export declare enum DnDEventType {
12
+ /** Fired when a drag operation starts */
13
+ DragStart = 0,
14
+ /** Fired during a drag operation when the drag position changes */
15
+ Drag = 1,
16
+ /** Fired when a drag operation ends */
17
+ DragEnd = 2,
18
+ /** Fired when a tap/select event occurs */
19
+ Select = 3,
20
+ /** Fired when layout information is updated */
21
+ Layout = 4,
22
+ /** Fired to force a layout update */
23
+ LayoutForceUpdate = 5
24
+ }
25
+ /**
26
+ * Interface representing a drag and drop event with associated data.
27
+ * @template DragData - The type of data being dragged
28
+ * @template DropData - The type of data for drop targets (defaults to DragData)
29
+ * @public
30
+ */
31
+ export interface DnDEvent<DragData extends object, DropData extends object = DragData> {
32
+ /** The type of drag and drop event */
33
+ type: DnDEventType;
34
+ /** The ID of the drag target element */
35
+ target?: number | null;
36
+ /** The drop target that the drag is currently over */
37
+ dropTarget?: DropTarget<DropData> | null;
38
+ /** The index position within the drop target */
39
+ dropTargetIndex?: number | null;
40
+ /** The data associated with the drag operation */
41
+ data?: DragData | null;
42
+ /** The current coordinates of the drag operation */
43
+ dragCoords?: DragCoords | null;
44
+ }
45
+ /**
46
+ * Type representing the coordinates of a drag operation.
47
+ * @public
48
+ */
49
+ export type DragCoords = {
50
+ /** The x-coordinate */
51
+ x: number;
52
+ /** The y-coordinate */
53
+ y: number;
54
+ };
55
+ /**
56
+ * Interface representing the drag and drop context type.
57
+ * @template DragData - The type of data being dragged
58
+ * @template DropData - The type of data for drop targets (defaults to DragData)
59
+ * @public
60
+ */
61
+ export interface DnDContextType<DragData extends object, DropData extends object = DragData> {
62
+ /** The monitor instance that tracks drag and drop operations */
63
+ monitor: Monitor<DragData, DropData>;
64
+ /** Whether a drag operation is currently active */
65
+ isDragging: boolean;
66
+ /** Shared value for drag coordinates */
67
+ sv: SharedValue<DragCoords>;
68
+ /** Shared value for overlay layout information */
69
+ svOverLayout: SharedValue<LayoutRectangle>;
70
+ }
71
+ /**
72
+ * Interface representing a draggable item with metadata and data.
73
+ * @template T - The type of data associated with the drag item
74
+ * @public
75
+ */
76
+ export interface DragItem<T> {
77
+ /** The type identifier for the drag item */
78
+ type: string;
79
+ /** The display label for the drag item */
80
+ label: string;
81
+ /** Optional icon component for the drag item */
82
+ icon?: FC<SvgProps>;
83
+ /** The data payload associated with the drag item */
84
+ data: T;
85
+ }
86
+ /**
87
+ * Props type for a draggable view component.
88
+ * @template T - The type of data associated with the drag item
89
+ * @public
90
+ */
91
+ export type DraggableViewProps<T> = PropsWithChildren<ViewProps> & {
92
+ /** The drag item configuration */
93
+ item: DragItem<T>;
94
+ };
95
+ /**
96
+ * Props type for the root drag and drop view component.
97
+ * @template DragData - The type of data being dragged
98
+ * @template DropData - The type of data for drop targets (defaults to DragData)
99
+ * @public
100
+ */
101
+ export type DnDRootViewProps<DragData extends object, DropData extends object = DragData> = PropsWithChildren<ViewProps> & {
102
+ /** Optional custom drag element renderer */
103
+ DragElement?: <T>(data: DragItem<T>) => ReactElement;
104
+ /** Callback fired when a drop operation completes */
105
+ onDrop?: (event: DnDEvent<DragData, DropData>, item: DragItem<DragData>) => void;
106
+ };
107
+ /**
108
+ * Props interface for the drop area component.
109
+ * @public
110
+ */
111
+ export interface DropAreaProps {
112
+ /** The ID of the parent drop target this area belongs to */
113
+ forId: number;
114
+ }
115
+ /**
116
+ * Enum representing the flex direction for drop target layouts.
117
+ * @public
118
+ */
119
+ export declare enum FlexDirection {
120
+ /** Vertical layout (column) */
121
+ Column = "column",
122
+ /** Horizontal layout (row) */
123
+ Row = "row"
124
+ }
125
+ /**
126
+ * Interface for configuring drop target layout properties.
127
+ * @public
128
+ */
129
+ export interface DropTargetLayoutConfig {
130
+ /** The index position within the parent container */
131
+ index?: number;
132
+ /** The z-index for layering */
133
+ zIndex?: number;
134
+ /** The flex direction for child elements */
135
+ flexDirection?: FlexDirection;
136
+ }
137
+ /**
138
+ * Interface for configuring drop target behavior and layout.
139
+ * @public
140
+ */
141
+ export interface DropTargetConfig extends DropTargetLayoutConfig {
142
+ /** Whether this drop target can accept drops */
143
+ canDrop?: boolean;
144
+ }
145
+ /**
146
+ * Type representing a layout position with required configuration properties.
147
+ * @public
148
+ */
149
+ export type LayoutPosition = LayoutRectangle & Required<DropTargetLayoutConfig>;
150
+ /**
151
+ * Interface representing a drop item with layout and data information.
152
+ * @template T - The type of data associated with the drop item
153
+ * @public
154
+ */
155
+ export interface DropItem<T> {
156
+ /** The layout position and configuration */
157
+ layout: LayoutPosition;
158
+ /** Optional child drop items */
159
+ children?: DropTree<T>;
160
+ /** Whether this item can accept drops */
161
+ canDrop?: boolean;
162
+ /** Optional data associated with this drop item */
163
+ data?: T;
164
+ }
165
+ /**
166
+ * Type representing a tree structure of drop items.
167
+ * @template T - The type of data associated with the drop items
168
+ * @public
169
+ */
170
+ export type DropTree<T> = Map<number, DropItem<T>>;
171
+ /**
172
+ * Interface for configuring the drag and drop monitor.
173
+ * @public
174
+ */
175
+ export interface MonitorConfig {
176
+ /** Padding around drop targets for hit detection */
177
+ padding: number;
178
+ /** Whether to track drag operations outside the root element */
179
+ trackOutside?: boolean;
180
+ }
181
+ /**
182
+ * Interface representing a drop target with all its properties.
183
+ * @template T - The type of data associated with the drop target
184
+ * @public
185
+ */
186
+ export interface DropTarget<T> {
187
+ /** Unique identifier for the drop target */
188
+ id: number;
189
+ /** Layout position and configuration */
190
+ layout: LayoutPosition;
191
+ /** Index position within the parent */
192
+ index: number;
193
+ /** Whether this target can accept drops */
194
+ canDrop?: boolean;
195
+ /** Optional child drop targets */
196
+ children?: DropTree<T>;
197
+ /** Optional data associated with this drop target */
198
+ data?: T;
199
+ }
200
+ /**
201
+ * Type representing a drag element target with layout and item information.
202
+ * @template T - The type of data associated with the drag item
203
+ * @public
204
+ */
205
+ export type DragElementTarget<T> = LayoutRectangle & {
206
+ item: DragItem<T>;
207
+ };
208
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,SA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Q,CAAC,CAAC,CAAC,CAAC;IACvB,qDAAqD;IACrD,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,eAAe,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Monitor } from '../monitor';
2
+ export { Monitor };
3
+ /**
4
+ * Enum representing the different types of drag and drop events.
5
+ * @public
6
+ */
7
+ export var DnDEventType;
8
+ (function (DnDEventType) {
9
+ /** Fired when a drag operation starts */
10
+ DnDEventType[DnDEventType["DragStart"] = 0] = "DragStart";
11
+ /** Fired during a drag operation when the drag position changes */
12
+ DnDEventType[DnDEventType["Drag"] = 1] = "Drag";
13
+ /** Fired when a drag operation ends */
14
+ DnDEventType[DnDEventType["DragEnd"] = 2] = "DragEnd";
15
+ /** Fired when a tap/select event occurs */
16
+ DnDEventType[DnDEventType["Select"] = 3] = "Select";
17
+ /** Fired when layout information is updated */
18
+ DnDEventType[DnDEventType["Layout"] = 4] = "Layout";
19
+ /** Fired to force a layout update */
20
+ DnDEventType[DnDEventType["LayoutForceUpdate"] = 5] = "LayoutForceUpdate";
21
+ })(DnDEventType || (DnDEventType = {}));
22
+ /**
23
+ * Enum representing the flex direction for drop target layouts.
24
+ * @public
25
+ */
26
+ export var FlexDirection;
27
+ (function (FlexDirection) {
28
+ /** Vertical layout (column) */
29
+ FlexDirection["Column"] = "column";
30
+ /** Horizontal layout (row) */
31
+ FlexDirection["Row"] = "row";
32
+ })(FlexDirection || (FlexDirection = {}));
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB;;;GAGG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,yCAAyC;IACzC,yDAAS,CAAA;IACT,mEAAmE;IACnE,+CAAI,CAAA;IACJ,uCAAuC;IACvC,qDAAO,CAAA;IACP,2CAA2C;IAC3C,mDAAM,CAAA;IACN,+CAA+C;IAC/C,mDAAM,CAAA;IACN,qCAAqC;IACrC,yEAAiB,CAAA;AACnB,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AA+GD;;;GAGG;AACH,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,+BAA+B;IAC/B,kCAAiB,CAAA;IACjB,8BAA8B;IAC9B,4BAAW,CAAA;AACb,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB"}
@@ -0,0 +1,11 @@
1
+ import { DnDEvent, DnDEventType } from '../types';
2
+ /**
3
+ * Creates a filter function for drag and drop events.
4
+ * This utility function returns a predicate that checks if an event matches any of the specified event types.
5
+ *
6
+ * @param events - The event types to filter for
7
+ * @returns A predicate function that returns true if the event matches any of the specified types
8
+ * @public
9
+ */
10
+ export declare const filterEvents: (...events: DnDEventType[]) => <DragTarget extends object, DropTarget extends object = DragTarget>(event: DnDEvent<DragTarget, DropTarget>) => boolean;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACtB,GAAG,QAAQ,YAAY,EAAE,MACzB,UAAU,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,GAAG,UAAU,EAChE,OAAO,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,YAGxC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { indexOf } from 'lodash';
2
+ /**
3
+ * Creates a filter function for drag and drop events.
4
+ * This utility function returns a predicate that checks if an event matches any of the specified event types.
5
+ *
6
+ * @param events - The event types to filter for
7
+ * @returns A predicate function that returns true if the event matches any of the specified types
8
+ * @public
9
+ */
10
+ export const filterEvents = (...events) => (event) => {
11
+ return indexOf(events, event.type) >= 0;
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,GAAG,MAAsB,EAAE,EAAE,CAC9B,CACE,KAAuC,EACvC,EAAE;IACF,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@mapples/dnd",
3
+ "version": "1.0.1",
4
+ "description": "A powerful and flexible drag and drop library for React Native applications",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "keywords": [
8
+ "react-native",
9
+ "drag-and-drop",
10
+ "gesture-handler",
11
+ "typescript",
12
+ "mobile"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc -b tsconfig.build.json",
16
+ "lint": "eslint .",
17
+ "type-check": "tsc --noEmit",
18
+ "clean": "rm -rf dist"
19
+ },
20
+ "author": {
21
+ "name": "Oleksandr Soloviov",
22
+ "url": "https://mapples.org/people/olek_soloviov"
23
+ },
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/mapplesorg/mapples-open-kit.git",
28
+ "directory": "packages/@mapples/dnd"
29
+ },
30
+ "dependencies": {
31
+ "lodash": "^4.17.21",
32
+ "rxjs": "^7.8.2"
33
+ },
34
+ "peerDependencies": {
35
+ "react": ">=18.0.0 <20.0.0",
36
+ "react-native": ">=0.71.0",
37
+ "react-native-gesture-handler": "~2.24.0",
38
+ "react-native-reanimated": "~3.17.4",
39
+ "react-native-svg": "15.11.2"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "react-native-gesture-handler": {
43
+ "optional": false
44
+ },
45
+ "react-native-reanimated": {
46
+ "optional": false
47
+ },
48
+ "react-native-svg": {
49
+ "optional": true
50
+ }
51
+ },
52
+ "devDependencies": {
53
+ "@types/lodash": "^4.17.16",
54
+ "@types/react": ">=18.0.0 <20.0.0",
55
+ "typescript": "~5.9.2"
56
+ },
57
+ "files": [
58
+ "dist",
59
+ "README.md",
60
+ "package.json"
61
+ ]
62
+ }