rege 0.4.0 → 0.5.0
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/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/{types-372314b9.d.ts → types-ca7f80e4.d.ts} +8 -8
- package/package.json +1 -1
- package/src/drag/index.ts +4 -3
- package/src/drag/react.ts +1 -1
- package/src/drag/types.ts +4 -4
- package/src/hover/index.ts +3 -2
- package/src/hover/react.ts +1 -1
- package/src/hover/types.ts +1 -1
- package/src/key/index.ts +4 -4
- package/src/key/react.ts +1 -1
- package/src/key/types.ts +1 -1
- package/src/pinch/index.ts +5 -3
- package/src/pinch/react.ts +1 -1
- package/src/pinch/types.ts +1 -1
- package/src/pinch/utils.ts +2 -1
- package/src/resize/index.ts +4 -3
- package/src/resize/react.ts +1 -1
- package/src/scroll/index.ts +4 -3
- package/src/scroll/react.ts +1 -1
- package/src/scroll/types.ts +3 -3
- package/src/scroll/utils.ts +2 -1
- package/src/wheel/index.ts +4 -3
- package/src/wheel/react.ts +1 -1
- package/src/wheel/types.ts +3 -3
- package/src/wheel/utils.ts +2 -1
package/src/resize/react.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resizeEvent } from '.'
|
|
2
2
|
import { useMutable, useOnce } from 'reev/src/react'
|
|
3
|
-
import { ResizeArg, ResizeState } from './types'
|
|
4
3
|
import { isF } from '../utils'
|
|
5
4
|
import type { ReactNode } from 'react'
|
|
5
|
+
import type { ResizeArg, ResizeState } from './types'
|
|
6
6
|
|
|
7
7
|
export const useResize = (arg: ResizeArg) => {
|
|
8
8
|
if (isF(arg)) arg = { resize: arg }
|
package/src/scroll/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { vec2, addV, cpV, subV } from '../utils'
|
|
2
2
|
import { scrollValues } from './utils'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { event } from 'reev/src'
|
|
4
|
+
import type { EventState } from 'reev/src'
|
|
5
|
+
import type { ScrollState } from './types'
|
|
5
6
|
|
|
6
7
|
export * from './types'
|
|
7
8
|
|
|
@@ -65,7 +66,7 @@ export const scrollEvent = <El extends Element = Element>(config?: ScrollState)
|
|
|
65
66
|
window.removeEventListener('scroll', self.scrolling)
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
const ref = (el:
|
|
69
|
+
const ref = (el: El | null) => {
|
|
69
70
|
self(config as ScrollState<El>)
|
|
70
71
|
if (el) {
|
|
71
72
|
self.mount(el)
|
package/src/scroll/react.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useOnce, useMutable } from 'reev/src/react'
|
|
2
|
-
import { ScrollConfig, ScrollState } from './types'
|
|
3
2
|
import { scrollEvent } from './index'
|
|
4
3
|
import { isF } from '../utils'
|
|
5
4
|
import type { ReactNode } from 'react'
|
|
5
|
+
import type { ScrollConfig, ScrollState } from './types'
|
|
6
6
|
|
|
7
7
|
export const useScroll = <El extends Element = Element>(config: ScrollConfig) => {
|
|
8
8
|
if (isF(config)) config = { scroll: config }
|
package/src/scroll/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vec2 } from '../utils'
|
|
1
|
+
import type { Vec2 } from '../utils'
|
|
2
2
|
|
|
3
3
|
export interface ScrollState<El extends Element = Element> {
|
|
4
4
|
_active: boolean
|
|
@@ -20,9 +20,9 @@ export interface ScrollState<El extends Element = Element> {
|
|
|
20
20
|
scrollStart(e: Event): void
|
|
21
21
|
scrolling(e: Event): void
|
|
22
22
|
scrollEnd(e: Event): void
|
|
23
|
-
mount(target:
|
|
23
|
+
mount(target: El): void
|
|
24
24
|
clean(target: null): void
|
|
25
|
-
ref(traget:
|
|
25
|
+
ref(traget: El | null): void
|
|
26
26
|
tick?: () => void
|
|
27
27
|
}
|
|
28
28
|
|
package/src/scroll/utils.ts
CHANGED
package/src/wheel/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { vec2, addV, cpV } from '../utils'
|
|
2
2
|
import { wheelValues } from './utils'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { event } from 'reev/src'
|
|
4
|
+
import type { EventState } from 'reev/src'
|
|
5
|
+
import type { WheelState } from './types'
|
|
5
6
|
|
|
6
7
|
export * from './types'
|
|
7
8
|
|
|
@@ -62,7 +63,7 @@ export const wheelEvent = <El extends Element = Element>(config?: WheelState) =>
|
|
|
62
63
|
target.removeEventListener('wheel', self.wheeling)
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const ref = (el:
|
|
66
|
+
const ref = (el: El | null) => {
|
|
66
67
|
self(config as WheelState<El>)
|
|
67
68
|
if (el) {
|
|
68
69
|
self.mount(el)
|
package/src/wheel/react.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useOnce, useMutable } from 'reev/src/react'
|
|
2
|
-
import { WheelConfig, WheelState } from './types'
|
|
3
2
|
import { wheelEvent } from './index'
|
|
4
3
|
import { isF } from '../utils'
|
|
5
4
|
import type { ReactNode } from 'react'
|
|
5
|
+
import type { WheelConfig, WheelState } from './types'
|
|
6
6
|
|
|
7
7
|
export const useWheel = <El extends Element = Element>(config: WheelConfig) => {
|
|
8
8
|
if (isF(config)) config = { wheel: config }
|
package/src/wheel/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vec2 } from '../utils'
|
|
1
|
+
import type { Vec2 } from '../utils'
|
|
2
2
|
|
|
3
3
|
export interface WheelState<El extends Element = Element> {
|
|
4
4
|
_active: boolean
|
|
@@ -20,9 +20,9 @@ export interface WheelState<El extends Element = Element> {
|
|
|
20
20
|
wheelStart(e: Event): void
|
|
21
21
|
wheeling(e: Event): void
|
|
22
22
|
wheelEnd(e: Event): void
|
|
23
|
-
mount(target:
|
|
23
|
+
mount(target: El): void
|
|
24
24
|
clean(target: null): void
|
|
25
|
-
ref(traget:
|
|
25
|
+
ref(traget: El | null): void
|
|
26
26
|
tick?: () => void
|
|
27
27
|
}
|
|
28
28
|
|
package/src/wheel/utils.ts
CHANGED