@dnd-kit/react 0.0.2-beta-20240604230258 → 0.0.2-beta-20240606131929

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/hooks.cjs CHANGED
@@ -49,6 +49,11 @@ function useComputed(compute, sync = false) {
49
49
  sync
50
50
  );
51
51
  }
52
+
53
+ // src/hooks/useImmediateEffect.ts
54
+ function useImmediateEffect(callback, _) {
55
+ callback();
56
+ }
52
57
  function useLatest(value) {
53
58
  const valueRef = react.useRef(value);
54
59
  useIsomorphicLayoutEffect(() => {
@@ -56,43 +61,22 @@ function useLatest(value) {
56
61
  }, [value]);
57
62
  return valueRef;
58
63
  }
59
-
60
- // src/hooks/useEvent.ts
61
- function useEvent(handler) {
62
- const handlerRef = useLatest(handler);
63
- return react.useCallback(
64
- function(...args) {
65
- return handlerRef.current?.(...args);
66
- },
67
- [handlerRef]
68
- );
69
- }
70
-
71
- // src/hooks/useImmediateEffect.ts
72
- function useImmediateEffect(callback, _) {
73
- callback();
74
- }
75
- function useOnValueChange(value, onChange, effect3 = react.useEffect, compare = Object.is) {
64
+ function useOnValueChange(value, onChange, effect2 = react.useEffect, compare = Object.is) {
76
65
  const tracked = react.useRef(value);
77
- effect3(() => {
66
+ effect2(() => {
78
67
  const oldValue = tracked.current;
79
- if (!compare(value, tracked.current)) {
68
+ if (!compare(value, oldValue)) {
80
69
  tracked.current = value;
81
70
  onChange(value, oldValue);
82
71
  }
83
72
  }, [onChange, value]);
84
73
  }
85
- function useSignalEffect(compute, deps = []) {
86
- react.useEffect(() => state.effect(compute), deps);
87
- }
88
74
 
89
75
  exports.useComputed = useComputed;
90
76
  exports.useConstant = useConstant;
91
- exports.useEvent = useEvent;
92
77
  exports.useImmediateEffect = useImmediateEffect;
93
78
  exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
94
79
  exports.useLatest = useLatest;
95
80
  exports.useOnValueChange = useOnValueChange;
96
- exports.useSignalEffect = useSignalEffect;
97
81
  //# sourceMappingURL=out.js.map
98
82
  //# sourceMappingURL=hooks.cjs.map
package/hooks.d.ts CHANGED
@@ -6,8 +6,6 @@ declare function useConstant<T = any>(initializer: () => T, dependency?: any): T
6
6
 
7
7
  declare function useComputed<T = any>(compute: () => T, sync?: boolean): _preact_signals_core.ReadonlySignal<T>;
8
8
 
9
- declare function useEvent<T extends Function>(handler: T | undefined): (...args: any) => any;
10
-
11
9
  declare function useImmediateEffect(callback: EffectCallback, _?: DependencyList): void;
12
10
 
13
11
  /**
@@ -20,6 +18,4 @@ declare function useLatest<T>(value: T): react.MutableRefObject<T | undefined>;
20
18
 
21
19
  declare function useOnValueChange<T>(value: T, onChange: (value: T, oldValue: T) => void, effect?: typeof useEffect, compare?: (value1: any, value2: any) => boolean): void;
22
20
 
23
- declare function useSignalEffect(compute: () => void, deps?: any[]): void;
24
-
25
- export { useComputed, useConstant, useEvent, useImmediateEffect, useIsomorphicLayoutEffect, useLatest, useOnValueChange, useSignalEffect };
21
+ export { useComputed, useConstant, useImmediateEffect, useIsomorphicLayoutEffect, useLatest, useOnValueChange };
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useRef, useLayoutEffect, useEffect, useCallback, useState } from 'react';
2
- import { computed, effect, Signal, signal } from '@dnd-kit/state';
1
+ import { useRef, useLayoutEffect, useEffect, useState } from 'react';
2
+ import { computed, Signal, signal, effect } from '@dnd-kit/state';
3
3
  import { flushSync } from 'react-dom';
4
4
 
5
5
  // src/hooks/useConstant.ts
@@ -47,6 +47,11 @@ function useComputed(compute, sync = false) {
47
47
  sync
48
48
  );
49
49
  }
50
+
51
+ // src/hooks/useImmediateEffect.ts
52
+ function useImmediateEffect(callback, _) {
53
+ callback();
54
+ }
50
55
  function useLatest(value) {
51
56
  const valueRef = useRef(value);
52
57
  useIsomorphicLayoutEffect(() => {
@@ -54,36 +59,17 @@ function useLatest(value) {
54
59
  }, [value]);
55
60
  return valueRef;
56
61
  }
57
-
58
- // src/hooks/useEvent.ts
59
- function useEvent(handler) {
60
- const handlerRef = useLatest(handler);
61
- return useCallback(
62
- function(...args) {
63
- return handlerRef.current?.(...args);
64
- },
65
- [handlerRef]
66
- );
67
- }
68
-
69
- // src/hooks/useImmediateEffect.ts
70
- function useImmediateEffect(callback, _) {
71
- callback();
72
- }
73
- function useOnValueChange(value, onChange, effect3 = useEffect, compare = Object.is) {
62
+ function useOnValueChange(value, onChange, effect2 = useEffect, compare = Object.is) {
74
63
  const tracked = useRef(value);
75
- effect3(() => {
64
+ effect2(() => {
76
65
  const oldValue = tracked.current;
77
- if (!compare(value, tracked.current)) {
66
+ if (!compare(value, oldValue)) {
78
67
  tracked.current = value;
79
68
  onChange(value, oldValue);
80
69
  }
81
70
  }, [onChange, value]);
82
71
  }
83
- function useSignalEffect(compute, deps = []) {
84
- useEffect(() => effect(compute), deps);
85
- }
86
72
 
87
- export { useComputed, useConstant, useEvent, useImmediateEffect, useIsomorphicLayoutEffect, useLatest, useOnValueChange, useSignalEffect };
73
+ export { useComputed, useConstant, useImmediateEffect, useIsomorphicLayoutEffect, useLatest, useOnValueChange };
88
74
  //# sourceMappingURL=out.js.map
89
75
  //# sourceMappingURL=hooks.js.map
package/index.cjs CHANGED
@@ -59,11 +59,11 @@ var DragDropProvider = react.forwardRef(
59
59
  });
60
60
  const { plugins, modifiers } = input;
61
61
  const handleBeforeDragStart = hooks.useLatest(onBeforeDragStart);
62
- const handleDragStart = hooks.useEvent(onDragStart);
62
+ const handleDragStart = hooks.useLatest(onDragStart);
63
63
  const handleDragOver = hooks.useLatest(onDragOver);
64
64
  const handleDragMove = hooks.useLatest(onDragMove);
65
65
  const handleDragEnd = hooks.useLatest(onDragEnd);
66
- const handleCollision = hooks.useEvent(onCollision);
66
+ const handleCollision = hooks.useLatest(onCollision);
67
67
  react.useEffect(() => {
68
68
  const listeners = [
69
69
  manager.monitor.addEventListener(
@@ -75,7 +75,10 @@ var DragDropProvider = react.forwardRef(
75
75
  }
76
76
  }
77
77
  ),
78
- manager.monitor.addEventListener("dragstart", handleDragStart),
78
+ manager.monitor.addEventListener(
79
+ "dragstart",
80
+ (event, manager2) => handleDragStart.current?.(event, manager2)
81
+ ),
79
82
  manager.monitor.addEventListener("dragover", (event, manager2) => {
80
83
  const callback = handleDragOver.current;
81
84
  if (callback) {
@@ -94,12 +97,13 @@ var DragDropProvider = react.forwardRef(
94
97
  trackRendering(() => callback(event, manager2));
95
98
  }
96
99
  }),
97
- manager.monitor.addEventListener("collision", handleCollision)
100
+ manager.monitor.addEventListener(
101
+ "collision",
102
+ (event, manager2) => handleCollision.current?.(event, manager2)
103
+ )
98
104
  ];
99
105
  return () => {
100
- for (const unsubscribe of listeners) {
101
- unsubscribe();
102
- }
106
+ listeners.forEach((unsubscribe) => unsubscribe());
103
107
  };
104
108
  }, [manager]);
105
109
  hooks.useOnValueChange(
@@ -108,9 +112,20 @@ var DragDropProvider = react.forwardRef(
108
112
  );
109
113
  hooks.useOnValueChange(modifiers, () => manager.modifiers = modifiers ?? []);
110
114
  react.useImperativeHandle(ref, () => manager, [manager]);
111
- return /* @__PURE__ */ jsxRuntime.jsx(DragDropContext.Provider, { value: manager, children });
115
+ return /* @__PURE__ */ jsxRuntime.jsxs(DragDropContext.Provider, { value: manager, children: [
116
+ children,
117
+ /* @__PURE__ */ jsxRuntime.jsx(Lifecycle, { manager })
118
+ ] });
112
119
  }
113
120
  );
121
+ var Lifecycle = class extends react.Component {
122
+ render() {
123
+ return null;
124
+ }
125
+ componentWillUnmount() {
126
+ this.props.manager.destroy();
127
+ }
128
+ };
114
129
  function useDragDropManager() {
115
130
  return react.useContext(DragDropContext);
116
131
  }
@@ -131,10 +146,21 @@ function useInstance(initializer) {
131
146
  // src/core/draggable/useDraggable.ts
132
147
  function useDraggable(input) {
133
148
  const { disabled, id, sensors } = input;
134
- const handle = utilities.getCurrentValue(input.handle);
135
- const element = utilities.getCurrentValue(input.element);
149
+ const handle = utilities.currentValue(input.handle);
150
+ const element = utilities.currentValue(input.element);
136
151
  const draggable = useInstance(
137
- (manager) => new dom.Draggable({ ...input, handle, element }, manager)
152
+ (manager) => new dom.Draggable(
153
+ {
154
+ ...input,
155
+ handle,
156
+ element,
157
+ options: {
158
+ ...input.options,
159
+ register: false
160
+ }
161
+ },
162
+ manager
163
+ )
138
164
  );
139
165
  const isDragSource = hooks.useComputed(() => draggable.isDragSource);
140
166
  hooks.useOnValueChange(id, () => draggable.id = id);
@@ -166,9 +192,19 @@ function useDraggable(input) {
166
192
  }
167
193
  function useDroppable(input) {
168
194
  const { collisionDetector, disabled, id, accept, type } = input;
169
- const element = utilities.getCurrentValue(input.element);
195
+ const element = utilities.currentValue(input.element);
170
196
  const droppable = useInstance(
171
- (manager) => new dom.Droppable({ ...input, element }, manager)
197
+ (manager) => new dom.Droppable(
198
+ {
199
+ ...input,
200
+ element,
201
+ options: {
202
+ ...input.options,
203
+ register: false
204
+ }
205
+ },
206
+ manager
207
+ )
172
208
  );
173
209
  const isDisabled = hooks.useComputed(() => droppable.disabled);
174
210
  const isDropTarget = hooks.useComputed(() => droppable.isDropTarget);
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { createContext, forwardRef, useEffect, useImperativeHandle, useTransition, useState, useRef, useContext, useCallback } from 'react';
1
+ import { createContext, forwardRef, useEffect, useImperativeHandle, Component, useTransition, useState, useRef, useContext, useCallback } from 'react';
2
2
  import { DragDropManager, defaultPreset, Draggable, Droppable } from '@dnd-kit/dom';
3
- import { useConstant, useLatest, useEvent, useOnValueChange, useComputed } from '@dnd-kit/react/hooks';
4
- import { jsx } from 'react/jsx-runtime';
5
- import { getCurrentValue } from '@dnd-kit/react/utilities';
3
+ import { useConstant, useLatest, useOnValueChange, useComputed } from '@dnd-kit/react/hooks';
4
+ import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { currentValue } from '@dnd-kit/react/utilities';
6
6
  import { deepEqual } from '@dnd-kit/state';
7
7
 
8
8
  // src/core/context/DragDropProvider.tsx
@@ -57,11 +57,11 @@ var DragDropProvider = forwardRef(
57
57
  });
58
58
  const { plugins, modifiers } = input;
59
59
  const handleBeforeDragStart = useLatest(onBeforeDragStart);
60
- const handleDragStart = useEvent(onDragStart);
60
+ const handleDragStart = useLatest(onDragStart);
61
61
  const handleDragOver = useLatest(onDragOver);
62
62
  const handleDragMove = useLatest(onDragMove);
63
63
  const handleDragEnd = useLatest(onDragEnd);
64
- const handleCollision = useEvent(onCollision);
64
+ const handleCollision = useLatest(onCollision);
65
65
  useEffect(() => {
66
66
  const listeners = [
67
67
  manager.monitor.addEventListener(
@@ -73,7 +73,10 @@ var DragDropProvider = forwardRef(
73
73
  }
74
74
  }
75
75
  ),
76
- manager.monitor.addEventListener("dragstart", handleDragStart),
76
+ manager.monitor.addEventListener(
77
+ "dragstart",
78
+ (event, manager2) => handleDragStart.current?.(event, manager2)
79
+ ),
77
80
  manager.monitor.addEventListener("dragover", (event, manager2) => {
78
81
  const callback = handleDragOver.current;
79
82
  if (callback) {
@@ -92,12 +95,13 @@ var DragDropProvider = forwardRef(
92
95
  trackRendering(() => callback(event, manager2));
93
96
  }
94
97
  }),
95
- manager.monitor.addEventListener("collision", handleCollision)
98
+ manager.monitor.addEventListener(
99
+ "collision",
100
+ (event, manager2) => handleCollision.current?.(event, manager2)
101
+ )
96
102
  ];
97
103
  return () => {
98
- for (const unsubscribe of listeners) {
99
- unsubscribe();
100
- }
104
+ listeners.forEach((unsubscribe) => unsubscribe());
101
105
  };
102
106
  }, [manager]);
103
107
  useOnValueChange(
@@ -106,9 +110,20 @@ var DragDropProvider = forwardRef(
106
110
  );
107
111
  useOnValueChange(modifiers, () => manager.modifiers = modifiers ?? []);
108
112
  useImperativeHandle(ref, () => manager, [manager]);
109
- return /* @__PURE__ */ jsx(DragDropContext.Provider, { value: manager, children });
113
+ return /* @__PURE__ */ jsxs(DragDropContext.Provider, { value: manager, children: [
114
+ children,
115
+ /* @__PURE__ */ jsx(Lifecycle, { manager })
116
+ ] });
110
117
  }
111
118
  );
119
+ var Lifecycle = class extends Component {
120
+ render() {
121
+ return null;
122
+ }
123
+ componentWillUnmount() {
124
+ this.props.manager.destroy();
125
+ }
126
+ };
112
127
  function useDragDropManager() {
113
128
  return useContext(DragDropContext);
114
129
  }
@@ -129,10 +144,21 @@ function useInstance(initializer) {
129
144
  // src/core/draggable/useDraggable.ts
130
145
  function useDraggable(input) {
131
146
  const { disabled, id, sensors } = input;
132
- const handle = getCurrentValue(input.handle);
133
- const element = getCurrentValue(input.element);
147
+ const handle = currentValue(input.handle);
148
+ const element = currentValue(input.element);
134
149
  const draggable = useInstance(
135
- (manager) => new Draggable({ ...input, handle, element }, manager)
150
+ (manager) => new Draggable(
151
+ {
152
+ ...input,
153
+ handle,
154
+ element,
155
+ options: {
156
+ ...input.options,
157
+ register: false
158
+ }
159
+ },
160
+ manager
161
+ )
136
162
  );
137
163
  const isDragSource = useComputed(() => draggable.isDragSource);
138
164
  useOnValueChange(id, () => draggable.id = id);
@@ -164,9 +190,19 @@ function useDraggable(input) {
164
190
  }
165
191
  function useDroppable(input) {
166
192
  const { collisionDetector, disabled, id, accept, type } = input;
167
- const element = getCurrentValue(input.element);
193
+ const element = currentValue(input.element);
168
194
  const droppable = useInstance(
169
- (manager) => new Droppable({ ...input, element }, manager)
195
+ (manager) => new Droppable(
196
+ {
197
+ ...input,
198
+ element,
199
+ options: {
200
+ ...input.options,
201
+ register: false
202
+ }
203
+ },
204
+ manager
205
+ )
170
206
  );
171
207
  const isDisabled = useComputed(() => droppable.disabled);
172
208
  const isDropTarget = useComputed(() => droppable.isDropTarget);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnd-kit/react",
3
- "version": "0.0.2-beta-20240604230258",
3
+ "version": "0.0.2-beta-20240606131929",
4
4
  "main": "./index.cjs",
5
5
  "module": "./index.js",
6
6
  "type": "module",
@@ -56,8 +56,8 @@
56
56
  "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
57
57
  },
58
58
  "dependencies": {
59
- "@dnd-kit/abstract": "0.0.2-beta-20240604230258",
60
- "@dnd-kit/dom": "0.0.2-beta-20240604230258",
59
+ "@dnd-kit/abstract": "0.0.2-beta-20240606131929",
60
+ "@dnd-kit/dom": "0.0.2-beta-20240606131929",
61
61
  "@dnd-kit/state": "*",
62
62
  "tslib": "^2.6.2"
63
63
  },
package/sortable.cjs CHANGED
@@ -16,6 +16,7 @@ function useSortable(input) {
16
16
  id,
17
17
  data,
18
18
  index,
19
+ group,
19
20
  disabled,
20
21
  feedback,
21
22
  sensors,
@@ -23,39 +24,44 @@ function useSortable(input) {
23
24
  type
24
25
  } = input;
25
26
  const manager = react.useDragDropManager();
26
- const handle = utilities.getCurrentValue(input.handle);
27
- const element = utilities.getCurrentValue(input.element);
28
- const sortable$1 = hooks.useConstant(
29
- () => new sortable.Sortable(
27
+ const handle = utilities.currentValue(input.handle);
28
+ const element = utilities.currentValue(input.element);
29
+ const sortable$1 = hooks.useConstant(() => {
30
+ return new sortable.Sortable(
30
31
  {
31
32
  ...input,
32
33
  handle,
33
34
  element,
34
- feedback
35
+ feedback,
36
+ options: {
37
+ ...input.options,
38
+ register: false
39
+ }
35
40
  },
36
41
  manager
37
- ),
38
- manager
39
- );
40
- react$1.useEffect(() => {
42
+ );
43
+ }, manager);
44
+ react$1.useLayoutEffect(() => {
41
45
  manager.registry.register(sortable$1.draggable);
42
46
  manager.registry.register(sortable$1.droppable);
43
47
  return () => {
44
48
  manager.registry.unregister(sortable$1.draggable);
45
49
  manager.registry.unregister(sortable$1.droppable);
46
50
  };
47
- }, [manager]);
51
+ }, [sortable$1, manager]);
48
52
  const isDisabled = hooks.useComputed(() => sortable$1.disabled);
49
53
  const isDropTarget = hooks.useComputed(() => sortable$1.isDropTarget);
50
54
  const isDragSource = hooks.useComputed(() => sortable$1.isDragSource);
55
+ hooks.useOnValueChange(id, () => sortable$1.id = id);
56
+ hooks.useOnValueChange(index, () => sortable$1.index = index, hooks.useIsomorphicLayoutEffect);
57
+ hooks.useOnValueChange(type, () => sortable$1.type = type);
58
+ hooks.useOnValueChange(group, () => sortable$1.group = group);
51
59
  hooks.useOnValueChange(
52
60
  accept,
53
61
  () => sortable$1.accept = accept,
54
62
  void 0,
55
63
  state.deepEqual
56
64
  );
57
- hooks.useOnValueChange(type, () => sortable$1.type = type);
58
- hooks.useOnValueChange(id, () => sortable$1.id = id);
59
65
  hooks.useOnValueChange(data, () => sortable$1.data = data ?? null);
60
66
  hooks.useOnValueChange(
61
67
  index,
@@ -66,7 +72,6 @@ function useSortable(input) {
66
72
  },
67
73
  hooks.useImmediateEffect
68
74
  );
69
- hooks.useOnValueChange(index, () => sortable$1.index = index, hooks.useIsomorphicLayoutEffect);
70
75
  hooks.useOnValueChange(handle, () => sortable$1.handle = handle);
71
76
  hooks.useOnValueChange(element, () => sortable$1.element = element);
72
77
  hooks.useOnValueChange(disabled, () => sortable$1.disabled = disabled === true);
package/sortable.js CHANGED
@@ -1,9 +1,9 @@
1
- import { useEffect, useCallback } from 'react';
1
+ import { useLayoutEffect, useCallback } from 'react';
2
2
  import { deepEqual } from '@dnd-kit/state';
3
3
  import { Sortable, defaultSortableTransition } from '@dnd-kit/dom/sortable';
4
4
  import { useDragDropManager } from '@dnd-kit/react';
5
- import { useConstant, useComputed, useOnValueChange, useImmediateEffect, useIsomorphicLayoutEffect } from '@dnd-kit/react/hooks';
6
- import { getCurrentValue } from '@dnd-kit/react/utilities';
5
+ import { useConstant, useComputed, useOnValueChange, useIsomorphicLayoutEffect, useImmediateEffect } from '@dnd-kit/react/hooks';
6
+ import { currentValue } from '@dnd-kit/react/utilities';
7
7
 
8
8
  // src/sortable/useSortable.ts
9
9
  function useSortable(input) {
@@ -14,6 +14,7 @@ function useSortable(input) {
14
14
  id,
15
15
  data,
16
16
  index,
17
+ group,
17
18
  disabled,
18
19
  feedback,
19
20
  sensors,
@@ -21,39 +22,44 @@ function useSortable(input) {
21
22
  type
22
23
  } = input;
23
24
  const manager = useDragDropManager();
24
- const handle = getCurrentValue(input.handle);
25
- const element = getCurrentValue(input.element);
26
- const sortable = useConstant(
27
- () => new Sortable(
25
+ const handle = currentValue(input.handle);
26
+ const element = currentValue(input.element);
27
+ const sortable = useConstant(() => {
28
+ return new Sortable(
28
29
  {
29
30
  ...input,
30
31
  handle,
31
32
  element,
32
- feedback
33
+ feedback,
34
+ options: {
35
+ ...input.options,
36
+ register: false
37
+ }
33
38
  },
34
39
  manager
35
- ),
36
- manager
37
- );
38
- useEffect(() => {
40
+ );
41
+ }, manager);
42
+ useLayoutEffect(() => {
39
43
  manager.registry.register(sortable.draggable);
40
44
  manager.registry.register(sortable.droppable);
41
45
  return () => {
42
46
  manager.registry.unregister(sortable.draggable);
43
47
  manager.registry.unregister(sortable.droppable);
44
48
  };
45
- }, [manager]);
49
+ }, [sortable, manager]);
46
50
  const isDisabled = useComputed(() => sortable.disabled);
47
51
  const isDropTarget = useComputed(() => sortable.isDropTarget);
48
52
  const isDragSource = useComputed(() => sortable.isDragSource);
53
+ useOnValueChange(id, () => sortable.id = id);
54
+ useOnValueChange(index, () => sortable.index = index, useIsomorphicLayoutEffect);
55
+ useOnValueChange(type, () => sortable.type = type);
56
+ useOnValueChange(group, () => sortable.group = group);
49
57
  useOnValueChange(
50
58
  accept,
51
59
  () => sortable.accept = accept,
52
60
  void 0,
53
61
  deepEqual
54
62
  );
55
- useOnValueChange(type, () => sortable.type = type);
56
- useOnValueChange(id, () => sortable.id = id);
57
63
  useOnValueChange(data, () => sortable.data = data ?? null);
58
64
  useOnValueChange(
59
65
  index,
@@ -64,7 +70,6 @@ function useSortable(input) {
64
70
  },
65
71
  useImmediateEffect
66
72
  );
67
- useOnValueChange(index, () => sortable.index = index, useIsomorphicLayoutEffect);
68
73
  useOnValueChange(handle, () => sortable.handle = handle);
69
74
  useOnValueChange(element, () => sortable.element = element);
70
75
  useOnValueChange(disabled, () => sortable.disabled = disabled === true);
package/utilities.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- // src/utilities/getCurrentValue.ts
4
- function getCurrentValue(value) {
3
+ // src/utilities/currentValue.ts
4
+ function currentValue(value) {
5
5
  if (value == null) {
6
6
  return void 0;
7
7
  }
@@ -11,6 +11,6 @@ function getCurrentValue(value) {
11
11
  return value;
12
12
  }
13
13
 
14
- exports.getCurrentValue = getCurrentValue;
14
+ exports.currentValue = currentValue;
15
15
  //# sourceMappingURL=out.js.map
16
16
  //# sourceMappingURL=utilities.cjs.map
package/utilities.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RefObject, MutableRefObject } from 'react';
2
2
 
3
3
  type RefOrValue<T> = T | RefObject<T | null | undefined> | MutableRefObject<T> | null | undefined;
4
- declare function getCurrentValue<T>(value: RefOrValue<T>): NonNullable<T> | undefined;
4
+ declare function currentValue<T>(value: RefOrValue<T>): NonNullable<T> | undefined;
5
5
 
6
- export { RefOrValue, getCurrentValue };
6
+ export { RefOrValue, currentValue };
package/utilities.js CHANGED
@@ -1,5 +1,5 @@
1
- // src/utilities/getCurrentValue.ts
2
- function getCurrentValue(value) {
1
+ // src/utilities/currentValue.ts
2
+ function currentValue(value) {
3
3
  if (value == null) {
4
4
  return void 0;
5
5
  }
@@ -9,6 +9,6 @@ function getCurrentValue(value) {
9
9
  return value;
10
10
  }
11
11
 
12
- export { getCurrentValue };
12
+ export { currentValue };
13
13
  //# sourceMappingURL=out.js.map
14
14
  //# sourceMappingURL=utilities.js.map