@tremolo-ui/react 0.1.0 → 0.1.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/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/hooks/useAnimationFrame.d.ts +1 -1
- package/dist/cjs/types/hooks/useAnimationFrame.d.ts.map +1 -1
- package/dist/cjs/types/hooks/useDrag.d.ts +2 -3
- package/dist/cjs/types/hooks/useDrag.d.ts.map +1 -1
- package/dist/cjs/types/hooks/useDragWithElement.d.ts +2 -3
- package/dist/cjs/types/hooks/useDragWithElement.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +15 -15
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/hooks/useAnimationFrame.d.ts +1 -1
- package/dist/esm/types/hooks/useAnimationFrame.d.ts.map +1 -1
- package/dist/esm/types/hooks/useDrag.d.ts +2 -3
- package/dist/esm/types/hooks/useDrag.d.ts.map +1 -1
- package/dist/esm/types/hooks/useDragWithElement.d.ts +2 -3
- package/dist/esm/types/hooks/useDragWithElement.d.ts.map +1 -1
- package/dist/esm/types/index.d.ts +15 -15
- package/dist/esm/types/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/src/Globals.d.ts +1 -0
- package/src/hooks/useAnimationFrame.ts +2 -2
- package/src/hooks/useDrag.ts +2 -2
- package/src/hooks/useDragWithElement.ts +2 -2
- package/src/index.ts +79 -15
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DependencyList } from 'react';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function useAnimationFrame(callback?: () => void, deps?: DependencyList): void;
|
|
3
3
|
//# sourceMappingURL=useAnimationFrame.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimationFrame.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAnimationFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,MAAM,OAAO,CAAA;AAEtE,
|
|
1
|
+
{"version":3,"file":"useAnimationFrame.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAnimationFrame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkC,MAAM,OAAO,CAAA;AAEtE,wBAAgB,iBAAiB,CAC/B,QAAQ,aAAW,EACnB,IAAI,GAAE,cAAmB,QAa1B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface UseDragProps {
|
|
2
2
|
threshold?: number;
|
|
3
3
|
onDrag: (x: number, y: number, deltaX: number, deltaY: number) => void;
|
|
4
4
|
onDragStart?: () => void;
|
|
@@ -7,9 +7,8 @@ interface Props {
|
|
|
7
7
|
/**
|
|
8
8
|
* @returns [refCallback, pointerDownHandler]
|
|
9
9
|
*/
|
|
10
|
-
export declare function useDrag<T extends Element>({ threshold, onDrag, onDragStart, onDragEnd, }:
|
|
10
|
+
export declare function useDrag<T extends Element>({ threshold, onDrag, onDragStart, onDragEnd, }: UseDragProps): [
|
|
11
11
|
(div: EventTarget | null) => void,
|
|
12
12
|
(event: React.PointerEvent<T>) => void
|
|
13
13
|
];
|
|
14
|
-
export {};
|
|
15
14
|
//# sourceMappingURL=useDrag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDrag.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACtE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,EACzC,SAAa,EACb,MAAM,EACN,WAAW,EACX,SAAS,GACV,EAAE,YAAY,GAAG;IAChB,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjC,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;CACvC,CAkEA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
interface
|
|
2
|
+
export interface UseDragWithElementProps<T extends Element> {
|
|
3
3
|
baseElementRef: RefObject<T | null>;
|
|
4
4
|
onDrag: (normalizedX: number, normalizedY: number) => void;
|
|
5
5
|
onDragStart?: (normalizedX: number, normalizedY: number) => void;
|
|
@@ -8,9 +8,8 @@ interface Props<T extends Element> {
|
|
|
8
8
|
/**
|
|
9
9
|
* @returns [refCallback, pointerDownHandler]
|
|
10
10
|
*/
|
|
11
|
-
export declare function useDragWithElement<T extends Element>({ baseElementRef, onDrag, onDragStart, onDragEnd, }:
|
|
11
|
+
export declare function useDragWithElement<T extends Element>({ baseElementRef, onDrag, onDragStart, onDragEnd, }: UseDragWithElementProps<T>): [
|
|
12
12
|
(div: EventTarget | null) => void,
|
|
13
13
|
(event: React.PointerEvent<T>) => void
|
|
14
14
|
];
|
|
15
|
-
export {};
|
|
16
15
|
//# sourceMappingURL=useDragWithElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDragWithElement.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDragWithElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtD,
|
|
1
|
+
{"version":3,"file":"useDragWithElement.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDragWithElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtD,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,OAAO;IACxD,cAAc,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IACnC,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1D,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;IAChE,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,OAAO,EAAE,EACpD,cAAc,EACd,MAAM,EACN,WAAW,EACX,SAAS,GACV,EAAE,uBAAuB,CAAC,CAAC,CAAC,GAAG;IAC9B,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjC,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;CACvC,CAkDA"}
|
|
@@ -4,19 +4,19 @@ import './components/NumberInput/index.css';
|
|
|
4
4
|
import './components/Piano/index.css';
|
|
5
5
|
import './components/Slider/index.css';
|
|
6
6
|
import './components/XYPad/index.css';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
7
|
+
export { type AbsoluteSizingProps, AnimationCanvas, type AnimationCanvasProps, type CommonProps, type DrawFunction, type InitFunction, type RelativeSizingProps, } from './components/AnimationCanvas';
|
|
8
|
+
export { AnimationKnob, type AnimationKnobMethods, type AnimationKnobProps, } from './components/AnimationKnob';
|
|
9
|
+
export { DragObserver, type DragObserverProps } from './components/DragObserver';
|
|
10
|
+
export { Knob, type KnobMethods, type KnobProps } from './components/Knob';
|
|
11
|
+
export { DecrementStepper, type DecrementStepperProps, IncrementStepper, type IncrementStepperProps, NumberInput, type NumberInputMethods, type NumberInputProps, Stepper, type StepperProps, } from './components/NumberInput';
|
|
12
|
+
export { BlackKey, KeyLabel, type KeyLabelProps, type KeyMethods, type KeyProps, type KeyboardShortcuts, Piano, type PianoProps, SHORTCUTS, WhiteKey, getNoteRangeArray, } from './components/Piano';
|
|
13
|
+
export { Scale, ScaleOption, type ScaleOptionProps, type ScaleProps, Slider, type SliderMethods, type SliderProps, SliderThumb, type SliderThumbMethods, type SliderThumbProps, SliderTrack, type SliderTrackProps, useSliderContext, } from './components/Slider';
|
|
14
|
+
export { WheelObserver, type WheelObserverProps, } from './components/WheelObserver';
|
|
15
|
+
export { type AreaProps, type ThumbProps, type ValueOptions, XYPad, XYPadArea, type XYPadMethods, type XYPadProps, XYPadThumb, type XYPadThumbMethods, } from './components/XYPad';
|
|
16
|
+
export { useAnimationFrame } from './hooks/useAnimationFrame';
|
|
17
|
+
export { useDrag, type UseDragProps } from './hooks/useDrag';
|
|
18
|
+
export { useDragWithElement, type UseDragWithElementProps, } from './hooks/useDragWithElement';
|
|
19
|
+
export { useEventListener } from './hooks/useEventListener';
|
|
20
|
+
export { useInterval } from './hooks/useInterval';
|
|
21
|
+
export { useLongPress } from './hooks/useLongPress';
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,6BAA6B,CAAA;AACpC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8BAA8B,CAAA;AACrC,OAAO,+BAA+B,CAAA;AACtC,OAAO,8BAA8B,CAAA;AAErC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAC3B,OAAO,6BAA6B,CAAA;AACpC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,8BAA8B,CAAA;AACrC,OAAO,+BAA+B,CAAA;AACtC,OAAO,8BAA8B,CAAA;AAErC,OAAO,EACL,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,mBAAmB,GACzB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAChF,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC1E,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,OAAO,EACP,KAAK,YAAY,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,EACL,KAAK,UAAU,EACf,SAAS,EACT,QAAQ,EACR,iBAAiB,GAClB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,KAAK,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,MAAM,EACN,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,WAAW,EACX,KAAK,gBAAgB,EACrB,gBAAgB,GACjB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,EACL,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,UAAU,EACV,KAAK,iBAAiB,GACvB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1993,7 +1993,7 @@ const XYPad = forwardRef((_a, ref) => {
|
|
|
1993
1993
|
} }, thumbProps)) }, areaProps)) }) })));
|
|
1994
1994
|
});
|
|
1995
1995
|
|
|
1996
|
-
|
|
1996
|
+
function useAnimationFrame(callback = () => { }, deps = []) {
|
|
1997
1997
|
const reqIdRef = useRef(-1);
|
|
1998
1998
|
const loop = useCallback(() => {
|
|
1999
1999
|
reqIdRef.current = requestAnimationFrame(loop);
|
|
@@ -2004,7 +2004,7 @@ const useAnimationFrame = (callback = () => { }, deps = []) => {
|
|
|
2004
2004
|
reqIdRef.current = requestAnimationFrame(loop);
|
|
2005
2005
|
return () => cancelAnimationFrame(reqIdRef.current);
|
|
2006
2006
|
}, [loop]);
|
|
2007
|
-
}
|
|
2007
|
+
}
|
|
2008
2008
|
|
|
2009
2009
|
export { AnimationCanvas, AnimationKnob, BlackKey, DecrementStepper, DragObserver, IncrementStepper, KeyLabel, Knob, NumberInput, Piano, SHORTCUTS, Scale, ScaleOption, Slider, SliderThumb, SliderTrack, Stepper, WheelObserver, WhiteKey, XYPad, XYPadArea, XYPadThumb, getNoteRangeArray, useAnimationFrame, useDrag, useDragWithElement, useEventListener, useInterval, useLongPress, useSliderContext };
|
|
2010
2010
|
//# sourceMappingURL=index.js.map
|