react-reorder-list 0.6.0 → 0.6.2

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/README.md CHANGED
@@ -1,13 +1,19 @@
1
1
  # react-reorder-list
2
+
2
3
  A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.
4
+
3
5
  ## Features
6
+
4
7
  - Reorders list of elements using drag and drop.
5
8
  - Easy to use
6
9
  - Smooth transition using animation.
7
10
  - Listen to children updates. See [listen to children updates](#listen-to-children-updates)
8
11
  - Handles nested lists easily. See [nested list usage](#nested-list-usage)
12
+
9
13
  ## Installation
14
+
10
15
  To install react-reorder-list
16
+
11
17
  ```bash
12
18
  # with npm:
13
19
  npm install react-reorder-list --save
@@ -21,50 +27,61 @@ To install react-reorder-list
21
27
  # with bun:
22
28
  bun add react-reorder-list
23
29
  ```
30
+
24
31
  ## Usage
32
+
25
33
  `react-reorder-list` default exports `<ReorderList>` component which encapsulates all the list items as its children.
26
34
 
27
35
  Items in this list can be reordered by simply dragging an item and dropping it in place of another item.
36
+
28
37
  #### Basic Usage
38
+
29
39
  Each `<div>` component inside `<ReorderList>` can now be drag-and-dropped to another `<div>` to reorder them.
40
+
30
41
  ```jsx
31
- import React from 'react'
32
- import ReorderList from 'react-reorder-list'
42
+ import React from "react";
43
+ import ReorderList from "react-reorder-list";
33
44
 
34
45
  export default function App() {
35
- return <ReorderList>
36
- {[0, 1, 2, 3, 4].map(i => {
37
- {/* Having a unique key is important */}
38
- return <div key={i}>Item {i}</div>
39
- })}
46
+ return (
47
+ <ReorderList>
48
+ {[0, 1, 2, 3, 4].map((i) => {
49
+ return <div key={i}>Item {i}</div>; // Having a unique key is important
50
+ })}
40
51
  </ReorderList>
52
+ );
41
53
  }
42
54
  ```
55
+
43
56
  #### Usage with ReorderIcon
57
+
44
58
  The dragging behavior can be changed using the `useOnlyIconToDrag` prop of `<ReorderList>` component.
45
59
 
46
60
  If set to `false`, an item can be dragged by clicking anywhere inside the item.
47
61
 
48
62
  If set to `true`, an item can be dragged only using the `<ReorderIcon>` present inside the item.
63
+
49
64
  ```jsx
50
65
  import React from 'react'
51
66
  import ReorderList, { ReorderIcon } from 'react-reorder-list'
52
67
 
53
68
  export default function App() {
54
- return <ReorderList useOnlyIconToDrag={true}>
55
- {[0, 1, 2, 3, 4].map(i => {
56
- return <div key={i}>
57
- <ReorderIcon /> {/* Default icon */}
58
- <ReorderIcon>
59
- {/* Custom icon/component */}
60
- </Reordericon>
61
- <span>{i}</span>
62
- </div>
63
- })}
64
- </ReorderList>
69
+ return <ReorderList useOnlyIconToDrag={true}>
70
+ {[0, 1, 2, 3, 4].map(i => {
71
+ return <div key={i}>
72
+ <ReorderIcon /> {/* Default icon */}
73
+ <ReorderIcon>
74
+ {/* Custom icon/component */}
75
+ </Reordericon>
76
+ <span>{i}</span>
77
+ </div>
78
+ })}
79
+ </ReorderList>
65
80
  }
66
81
  ```
82
+
67
83
  #### Listen to Children Updates
84
+
68
85
  `<ReorderList>` can listen to updates to it's children components using the `watchChildrenUpdates` prop as shown below.
69
86
 
70
87
  If set to `false`, any updates made in children component except reordering by user won't reflect.
@@ -74,83 +91,103 @@ Further if `preserveOrder` is set to false, the order in which new children appe
74
91
  Whereas if `preserveOrder` is set to true, the order of existing items will be preserved as before the update occured and new items will be placed at the end irrespective of their order in children. Also, if an item is being dragged and an update occurs at that moment, that item will be placed at respective location and `onPositionChange` will be called to prevent any inconsistency.
75
92
 
76
93
  NOTE: The props `watchChildrenUpdates` and `preserveOrder` should be used carefully to avoid any unexpected behaviour
94
+
77
95
  ```jsx
78
- import React, { useState } from 'react'
79
- import ReorderList from 'react-reorder-list'
96
+ import React, { useState } from "react";
97
+ import ReorderList from "react-reorder-list";
80
98
 
81
99
  export default function App() {
82
- const [array, setArray] = useState([0, 1, 2, 3, 4])
83
-
84
- function setNewArray() {
85
- setArray(prev => {
86
- const array = []
87
- prev.forEach(_ => {
88
- do {
89
- var item = Math.floor(Math.random() * 9)
90
- } while (array.includes(item))
91
- array.push(item)
92
- })
93
- return array
94
- })
95
- }
96
-
97
- return <div>
98
- <ReorderList watchChildrenUpdates={true} animationDuration={200}>
99
- {array.map(i => <div key={i}>Item {i}</div>)}
100
- </ReorderList>
101
- <button onClick={setNewArray}>Click me</button>
100
+ const [array, setArray] = useState([0, 1, 2, 3, 4]);
101
+
102
+ function setNewArray() {
103
+ setArray((prev) => {
104
+ const array = [];
105
+ prev.forEach((_) => {
106
+ do {
107
+ var item = Math.floor(Math.random() * 9);
108
+ } while (array.includes(item));
109
+ array.push(item);
110
+ });
111
+ return array;
112
+ });
113
+ }
114
+
115
+ return (
116
+ <div>
117
+ <ReorderList watchChildrenUpdates={true} animationDuration={200}>
118
+ {array.map((i) => (
119
+ <div key={i}>Item {i}</div>
120
+ ))}
121
+ </ReorderList>
122
+ <button onClick={setNewArray}>Click me</button>
102
123
  </div>
124
+ );
103
125
  }
104
126
  ```
127
+
105
128
  #### Nested List Usage
129
+
106
130
  ```jsx
107
- import React from 'react'
108
- import ReorderList, { ReorderIcon } from 'react-reorder-list'
131
+ import React from "react";
132
+ import ReorderList, { ReorderIcon } from "react-reorder-list";
109
133
 
110
134
  export default function App() {
111
- return <ReorderList>
112
- {[0, 1, 2].map(i => {
113
- return <div key={i}>
114
- <ReorderIcon />
115
- <span>{'Parent' + i}</span>
116
- <ReorderList useOnlyIconToDrag={true}>
117
- {[0, 1, 2].map(j => {
118
- return <div key={j} style={{ paddingLeft: '16px' }}>
119
- <ReorderIcon />
120
- <span>{'Child' + i + j}</span>
121
- </div>
122
- })}
123
- </ReorderList>
124
- </div>
125
- })}
135
+ return (
136
+ <ReorderList>
137
+ {[0, 1, 2].map((i) => {
138
+ return (
139
+ <div key={i}>
140
+ <ReorderIcon />
141
+ <span>{"Parent" + i}</span>
142
+ <ReorderList useOnlyIconToDrag={true}>
143
+ {[0, 1, 2].map((j) => {
144
+ return (
145
+ <div key={j} style={{ paddingLeft: "16px" }}>
146
+ <ReorderIcon />
147
+ <span>{"Child" + i + j}</span>
148
+ </div>
149
+ );
150
+ })}
151
+ </ReorderList>
152
+ </div>
153
+ );
154
+ })}
126
155
  </ReorderList>
156
+ );
127
157
  }
128
158
  ```
159
+
129
160
  ## ReorderList Component API Reference
161
+
130
162
  Here is the full API for the `<ReorderList>` component, these properties can be set on an instance of ReorderList:
131
163
  | Parameter | Type | Required | Default | Description |
132
164
  | - | - | - | - | - |
133
- | `useOnlyIconToDrag` | `Boolean` | No | false | See [usage with ReorderIcon](#usage-with-reordericon) |
134
- | `selectedItemOpacity` | `Number (0 to 1)` | No | 0.5 | This determines the opacity of the item being dragged, until released. |
135
- | `animationDuration` | `Number` | No | 400 | The duration (in ms) of swapping animation between items. If set to 0, animation will be disabled. |
136
- | `watchChildrenUpdates` | `Boolean` | No | false | Enable this to listen to any updates in children of `<ReorderList>` and update the state accordingly. See [listen to children updates](#listen-to-children-updates) |
137
- | `preserveOrder` | `Boolean` | No | false | Works along woth `watchChildrenUpdates` to determine whether to preserve existing order or not. See [listen to children updates](#listen-to-children-updates) |
165
+ | `useOnlyIconToDrag` | `boolean` | No | false | See [usage with ReorderIcon](#usage-with-reordericon) |
166
+ | `selectedItemOpacity` | `number (0 to 1)` | No | 0.5 | This determines the opacity of the item being dragged, until released. |
167
+ | `animationDuration` | `number` | No | 400 | The duration (in ms) of swapping animation between items. If set to 0, animation will be disabled. |
168
+ | `watchChildrenUpdates` | `boolean` | No | false | Enable this to listen to any updates in children of `<ReorderList>` and update the state accordingly. See [listen to children updates](#listen-to-children-updates) |
169
+ | `preserveOrder` | `boolean` | No | false | Works along woth `watchChildrenUpdates` to determine whether to preserve existing order or not. See [listen to children updates](#listen-to-children-updates) |
138
170
  | `onPositionChange` | [`PositionChangeHandler`](#positionchangehandler) | No | - | Function to be executed on item position change. |
139
- | `disabled` | `Boolean` | No | false | When set to true, `<ReorderList>` will work as a plain `div` with no functionality. |
171
+ | `disabled` | `boolean` | No | false | When set to true, `<ReorderList>` will work as a plain `div` with no functionality. |
140
172
  | `props` | `React.DetailedHTMLProps` | No | - | Props to customize the `<ReorderList>` component. |
173
+
141
174
  ### Types
175
+
142
176
  #### PositionChangeHandler
177
+
143
178
  ```typescript
144
- import { ReactNode } from 'react';
145
- type RevertHandler = () => void
146
- type PositionChangeParams = {
147
- start?: number // Index of the item being dragged
148
- end?: number // Index of the item being displaced by the starting item
149
- oldItems?: ReactNode[] // Array of children before reordering
150
- newItems?: ReactNode[] // Array of children after reordering
151
- revert: RevertHandler // A fallback handler to revert the reordering
152
- }
153
- type PositionChangeHandler = (params?: PositionChangeParams) => void
179
+ import { ReactNode } from "react";
180
+ type RevertHandler = () => void;
181
+ type PositionChangeParams = {
182
+ start?: number; // Index of the item being dragged
183
+ end?: number; // Index of the item being displaced by the starting item
184
+ oldItems?: ReactNode[]; // Array of children before reordering
185
+ newItems?: ReactNode[]; // Array of children after reordering
186
+ revert: RevertHandler; // A fallback handler to revert the reordering
187
+ };
188
+ type PositionChangeHandler = (params?: PositionChangeParams) => void;
154
189
  ```
190
+
155
191
  ## Author
156
- [Sahil Aggarwal](https://www.github.com/SahilAggarwal2004)
192
+
193
+ [Sahil Aggarwal](https://www.github.com/SahilAggarwal2004)
package/dist/animation.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { useState, useLayoutEffect, Children, useEffect, useRef } from "react";
2
2
  function usePrevious(value) {
3
3
  const prevChildrenRef = useRef();
4
- useEffect(() => { prevChildrenRef.current = value; }, [value]);
4
+ useEffect(() => {
5
+ prevChildrenRef.current = value;
6
+ }, [value]);
5
7
  return prevChildrenRef.current;
6
8
  }
7
- ;
8
9
  function calculateBoundingBoxes(children) {
9
10
  const boundingBoxes = {};
10
- Children.forEach(children, child => boundingBoxes[child.key.split("/.")[0]] = child.ref.current.getBoundingClientRect());
11
+ Children.forEach(children, (child) => (boundingBoxes[child.key.split("/.")[0]] = child.ref.current.getBoundingClientRect()));
11
12
  return boundingBoxes;
12
13
  }
13
- ;
14
14
  export default function Animation({ duration, children }) {
15
15
  const [boundingBox, setBoundingBox] = useState({});
16
16
  const prevBoundingBox = usePrevious(boundingBox);
@@ -22,7 +22,7 @@ export default function Animation({ duration, children }) {
22
22
  }, [children]);
23
23
  useLayoutEffect(() => {
24
24
  if (duration > 0 && prevBoundingBox && Object.keys(prevBoundingBox).length)
25
- Children.forEach(children, child => {
25
+ Children.forEach(children, (child) => {
26
26
  const domNode = child.ref.current;
27
27
  const key = child.key.split("/.")[0];
28
28
  const { left: prevLeft, top: prevTop } = prevBoundingBox[key] || {};
@@ -41,4 +41,3 @@ export default function Animation({ duration, children }) {
41
41
  }, [boundingBox]);
42
42
  return children;
43
43
  }
44
- ;
package/dist/icons.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  export function PiDotsSixVerticalBold(props) {
3
- return React.createElement("span", Object.assign({}, props),
3
+ return (React.createElement("span", Object.assign({}, props),
4
4
  React.createElement("svg", { viewBox: "0 0 256 256", fill: "currentColor", width: "1.25rem", height: "1.25rem" },
5
- React.createElement("path", { d: "M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z" })));
5
+ React.createElement("path", { d: "M108,60A16,16,0,1,1,92,44,16,16,0,0,1,108,60Zm56,16a16,16,0,1,0-16-16A16,16,0,0,0,164,76ZM92,112a16,16,0,1,0,16,16A16,16,0,0,0,92,112Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,112ZM92,180a16,16,0,1,0,16,16A16,16,0,0,0,92,180Zm72,0a16,16,0,1,0,16,16A16,16,0,0,0,164,180Z" }))));
6
6
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import { Props } from "./hooks.js";
3
- export type { Props } from './hooks.js';
3
+ export type { Props } from "./hooks.js";
4
4
  export type PositionChangeHandler = (params?: {
5
5
  start?: number;
6
6
  end?: number;
@@ -19,6 +19,6 @@ export type ReorderListProps = {
19
19
  props?: Props;
20
20
  children?: ReactNode;
21
21
  };
22
- export type { IconProps } from './icons.js';
22
+ export type { IconProps } from "./icons.js";
23
23
  export default function ReorderList({ useOnlyIconToDrag, selectedItemOpacity, animationDuration, watchChildrenUpdates, preserveOrder, onPositionChange, disabled, props, children }: ReorderListProps): React.JSX.Element;
24
24
  export declare function ReorderIcon({ children, style, ...props }: Props): React.JSX.Element;
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { PiDotsSixVerticalBold } from "./icons.js";
14
14
  import Animation from "./animation.js";
15
15
  import useDraggable from "./hooks.js";
16
16
  if (typeof window !== "undefined")
17
- import('drag-drop-touch');
17
+ import("drag-drop-touch");
18
18
  const scrollThreshold = { x: 10, y: 100 };
19
19
  const ReorderItemRef = forwardRef(ReorderItem);
20
20
  export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpacity = 0.5, animationDuration = 400, watchChildrenUpdates = false, preserveOrder = false, onPositionChange, disabled = false, props, children }) {
@@ -25,8 +25,8 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
25
25
  const [temp, setTemp] = useState({});
26
26
  const [isAnimating, setIsAnimating] = useState(false);
27
27
  const [scroll, setScroll] = useState();
28
- const refs = useMemo(() => items.map(_ => createRef()), [items]);
29
- const findIndex = (key) => key ? items.findIndex(item => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.key) === null || _a === void 0 ? void 0 : _a.split(".$").at(-1)) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.toString()) === key; }) : -1;
28
+ const refs = useMemo(() => items.map((_) => createRef()), [items]);
29
+ const findIndex = (key) => (key ? items.findIndex((item) => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.key) === null || _a === void 0 ? void 0 : _a.split(".$").at(-1)) !== null && _b !== void 0 ? _b : item === null || item === void 0 ? void 0 : item.toString()) === key; }) : -1);
30
30
  useEffect(() => {
31
31
  if (!watchChildrenUpdates)
32
32
  return;
@@ -35,7 +35,7 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
35
35
  if (preserveOrder) {
36
36
  const items = [];
37
37
  const newItems = [];
38
- Children.forEach(children, child => {
38
+ Children.forEach(children, (child) => {
39
39
  var _a;
40
40
  const index = findIndex((_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString());
41
41
  if (index === -1)
@@ -43,7 +43,7 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
43
43
  else
44
44
  items[index] = child;
45
45
  });
46
- setItems(items.filter(item => item !== undefined).concat(newItems));
46
+ setItems(items.filter((item) => item !== undefined).concat(newItems));
47
47
  }
48
48
  else
49
49
  setItems(Children.toArray(children));
@@ -55,7 +55,7 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
55
55
  const { scrollWidth, scrollHeight } = document.body;
56
56
  const interval = setInterval(() => {
57
57
  if (left < 0 || top < 0 || scrollWidth - scrollX > innerWidth - left || scrollHeight - scrollY > innerHeight - top)
58
- scrollBy({ left, top, behavior: 'instant' });
58
+ scrollBy({ left, top, behavior: "instant" });
59
59
  }, 20);
60
60
  return () => clearInterval(interval);
61
61
  }, [scroll]);
@@ -66,14 +66,14 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
66
66
  setStart(-1);
67
67
  setSelected(-1);
68
68
  }
69
- return React.createElement("div", Object.assign({ ref: ref }, props), disabled ? children : React.createElement(Animation, { duration: +(start !== -1 && !scroll) && animationDuration }, Children.map(items, (child, i) => {
69
+ return (React.createElement("div", Object.assign({ ref: ref }, props), disabled ? (children) : (React.createElement(Animation, { duration: +(start !== -1 && !scroll) && animationDuration }, Children.map(items, (child, i) => {
70
70
  var _a;
71
- return React.createElement(ReorderItemRef, { key: (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString(), ref: refs[i], useOnlyIconToDrag: useOnlyIconToDrag, style: { opacity: selected === i ? selectedItemOpacity : 1, touchAction: "pan-y" }, onDragStart: event => {
71
+ return (React.createElement(ReorderItemRef, { key: (_a = child === null || child === void 0 ? void 0 : child.key) !== null && _a !== void 0 ? _a : child === null || child === void 0 ? void 0 : child.toString(), ref: refs[i], useOnlyIconToDrag: useOnlyIconToDrag, style: { opacity: selected === i ? selectedItemOpacity : 1, touchAction: "pan-y" }, onDragStart: (event) => {
72
72
  event.stopPropagation();
73
73
  setStart(i);
74
74
  setSelected(i);
75
75
  setTemp({ items, rect: ref.current.children[i].getBoundingClientRect() });
76
- }, onDragEnter: event => {
76
+ }, onDragEnter: (event) => {
77
77
  event.stopPropagation();
78
78
  if (start === -1 || selected === i || isAnimating)
79
79
  return;
@@ -89,7 +89,7 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
89
89
  });
90
90
  setIsAnimating(true);
91
91
  setTimeout(() => setIsAnimating(false), animationDuration);
92
- }, onDragEnd: handleDragEnd, onTouchMove: event => {
92
+ }, onDragEnd: handleDragEnd, onTouchMove: (event) => {
93
93
  const { clientX, screenX, clientY, screenY } = event.touches[0];
94
94
  let left = 0, top = 0;
95
95
  if (clientX < scrollThreshold.x)
@@ -100,25 +100,25 @@ export default function ReorderList({ useOnlyIconToDrag = false, selectedItemOpa
100
100
  top = -10;
101
101
  else if (innerHeight - screenY < scrollThreshold.y)
102
102
  top = 10;
103
- setScroll((left || top) ? { left, top } : undefined);
104
- }, onTouchEnd: () => setScroll(undefined) }, child);
105
- })));
103
+ setScroll(left || top ? { left, top } : undefined);
104
+ }, onTouchEnd: () => setScroll(undefined) }, child));
105
+ })))));
106
106
  }
107
107
  function ReorderItem(_a, ref) {
108
108
  var { useOnlyIconToDrag, onTouchEnd: propOnTouchEnd, children } = _a, props = __rest(_a, ["useOnlyIconToDrag", "onTouchEnd", "children"]);
109
109
  const _b = useDraggable(), { draggable } = _b, _c = _b.draggableProps, { onTouchEnd: draggableOnTouchEnd } = _c, draggableProps = __rest(_c, ["onTouchEnd"]);
110
- const recursiveClone = (children) => Children.map(children, child => {
110
+ const recursiveClone = (children) => Children.map(children, (child) => {
111
111
  if (!isValidElement(child))
112
112
  return child;
113
- return cloneElement(child, Object.assign({ children: recursiveClone(child.props.children) }, (child.type === ReorderIcon && draggableProps)));
113
+ return cloneElement(child, child.type === ReorderIcon ? draggableProps : {}, recursiveClone(child.props.children));
114
114
  });
115
- const recursiveChildren = useMemo(() => useOnlyIconToDrag ? recursiveClone(children) : children, [children]);
116
- return React.createElement("div", Object.assign({ ref: ref, draggable: draggable }, props, (!useOnlyIconToDrag && draggableProps), { onTouchEnd: event => {
115
+ const recursiveChildren = useMemo(() => (useOnlyIconToDrag ? recursiveClone(children) : children), [useOnlyIconToDrag, children]);
116
+ return (React.createElement("div", Object.assign({ ref: ref, draggable: draggable }, props, (!useOnlyIconToDrag && draggableProps), { onTouchEnd: (event) => {
117
117
  draggableOnTouchEnd(event);
118
118
  propOnTouchEnd(event);
119
- } }), recursiveChildren);
119
+ } }), recursiveChildren));
120
120
  }
121
121
  export function ReorderIcon(_a) {
122
122
  var { children = React.createElement(PiDotsSixVerticalBold, null), style } = _a, props = __rest(_a, ["children", "style"]);
123
- return React.createElement("span", Object.assign({ style: Object.assign({ cursor: "grab" }, style) }, props), children);
123
+ return (React.createElement("span", Object.assign({ style: Object.assign({ cursor: "grab" }, style) }, props), children));
124
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-reorder-list",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "A simple react component that facilitates the reordering of JSX/HTML elements through drag-and-drop functionality, allowing for easy position changes.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",