@tremolo-ui/react 0.1.1 → 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.
@@ -1,3 +1,3 @@
1
1
  import { DependencyList } from 'react';
2
- export declare const useAnimationFrame: (callback?: () => void, deps?: DependencyList) => void;
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,eAAO,MAAM,iBAAiB,GAC5B,qBAAmB,EACnB,OAAM,cAAmB,SAa1B,CAAA"}
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 Props {
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, }: Props): [
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,UAAU,KAAK;IACb,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,KAAK,GAAG;IACT,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjC,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;CACvC,CAkEA"}
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 Props<T extends Element> {
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, }: Props<T>): [
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,UAAU,KAAK,CAAC,CAAC,SAAS,OAAO;IAC/B,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,KAAK,CAAC,CAAC,CAAC,GAAG;IACZ,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;IACjC,CAAC,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI;CACvC,CAkDA"}
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 * from './components/AnimationCanvas';
8
- export * from './components/AnimationKnob';
9
- export * from './components/DragObserver';
10
- export * from './components/Knob';
11
- export * from './components/NumberInput';
12
- export * from './components/Piano';
13
- export * from './components/Slider';
14
- export * from './components/WheelObserver';
15
- export * from './components/XYPad';
16
- export * from './hooks/useAnimationFrame';
17
- export * from './hooks/useDrag';
18
- export * from './hooks/useDragWithElement';
19
- export * from './hooks/useEventListener';
20
- export * from './hooks/useInterval';
21
- export * from './hooks/useLongPress';
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,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react",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React component library for audio app",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,9 +1,9 @@
1
1
  import { DependencyList, useCallback, useEffect, useRef } from 'react'
2
2
 
3
- export const useAnimationFrame = (
3
+ export function useAnimationFrame(
4
4
  callback = () => {},
5
5
  deps: DependencyList = [],
6
- ) => {
6
+ ) {
7
7
  const reqIdRef = useRef(-1)
8
8
  const loop = useCallback(() => {
9
9
  reqIdRef.current = requestAnimationFrame(loop)
@@ -3,7 +3,7 @@ import { useRef, useCallback } from 'react'
3
3
  import { useEventListener } from './useEventListener'
4
4
  import { useRefCallbackEvent } from './useRefCallbackEvent'
5
5
 
6
- interface Props {
6
+ export interface UseDragProps {
7
7
  threshold?: number
8
8
 
9
9
  onDrag: (x: number, y: number, deltaX: number, deltaY: number) => void
@@ -19,7 +19,7 @@ export function useDrag<T extends Element>({
19
19
  onDrag,
20
20
  onDragStart,
21
21
  onDragEnd,
22
- }: Props): [
22
+ }: UseDragProps): [
23
23
  (div: EventTarget | null) => void,
24
24
  (event: React.PointerEvent<T>) => void,
25
25
  ] {
@@ -5,7 +5,7 @@ import { normalizeValue } from '@tremolo-ui/functions'
5
5
  import { useEventListener } from './useEventListener'
6
6
  import { useRefCallbackEvent } from './useRefCallbackEvent'
7
7
 
8
- interface Props<T extends Element> {
8
+ export interface UseDragWithElementProps<T extends Element> {
9
9
  baseElementRef: RefObject<T | null>
10
10
  onDrag: (normalizedX: number, normalizedY: number) => void
11
11
  onDragStart?: (normalizedX: number, normalizedY: number) => void
@@ -20,7 +20,7 @@ export function useDragWithElement<T extends Element>({
20
20
  onDrag,
21
21
  onDragStart,
22
22
  onDragEnd,
23
- }: Props<T>): [
23
+ }: UseDragWithElementProps<T>): [
24
24
  (div: EventTarget | null) => void,
25
25
  (event: React.PointerEvent<T>) => void,
26
26
  ] {
package/src/index.ts CHANGED
@@ -5,19 +5,83 @@ import './components/Piano/index.css'
5
5
  import './components/Slider/index.css'
6
6
  import './components/XYPad/index.css'
7
7
 
8
- export * from './components/AnimationCanvas'
9
- export * from './components/AnimationKnob'
10
- export * from './components/DragObserver'
11
- export * from './components/Knob'
12
- export * from './components/NumberInput'
13
- export * from './components/Piano'
14
- export * from './components/Slider'
15
- export * from './components/WheelObserver'
16
- export * from './components/XYPad'
8
+ export {
9
+ type AbsoluteSizingProps,
10
+ AnimationCanvas,
11
+ type AnimationCanvasProps,
12
+ type CommonProps,
13
+ type DrawFunction,
14
+ type InitFunction,
15
+ type RelativeSizingProps,
16
+ } from './components/AnimationCanvas'
17
+ export {
18
+ AnimationKnob,
19
+ type AnimationKnobMethods,
20
+ type AnimationKnobProps,
21
+ } from './components/AnimationKnob'
22
+ export { DragObserver, type DragObserverProps } from './components/DragObserver'
23
+ export { Knob, type KnobMethods, type KnobProps } from './components/Knob'
24
+ export {
25
+ DecrementStepper,
26
+ type DecrementStepperProps,
27
+ IncrementStepper,
28
+ type IncrementStepperProps,
29
+ NumberInput,
30
+ type NumberInputMethods,
31
+ type NumberInputProps,
32
+ Stepper,
33
+ type StepperProps,
34
+ } from './components/NumberInput'
35
+ export {
36
+ BlackKey,
37
+ KeyLabel,
38
+ type KeyLabelProps,
39
+ type KeyMethods,
40
+ type KeyProps,
41
+ type KeyboardShortcuts,
42
+ Piano,
43
+ type PianoProps,
44
+ SHORTCUTS,
45
+ WhiteKey,
46
+ getNoteRangeArray,
47
+ } from './components/Piano'
48
+ export {
49
+ Scale,
50
+ ScaleOption,
51
+ type ScaleOptionProps,
52
+ type ScaleProps,
53
+ Slider,
54
+ type SliderMethods,
55
+ type SliderProps,
56
+ SliderThumb,
57
+ type SliderThumbMethods,
58
+ type SliderThumbProps,
59
+ SliderTrack,
60
+ type SliderTrackProps,
61
+ useSliderContext,
62
+ } from './components/Slider'
63
+ export {
64
+ WheelObserver,
65
+ type WheelObserverProps,
66
+ } from './components/WheelObserver'
67
+ export {
68
+ type AreaProps,
69
+ type ThumbProps,
70
+ type ValueOptions,
71
+ XYPad,
72
+ XYPadArea,
73
+ type XYPadMethods,
74
+ type XYPadProps,
75
+ XYPadThumb,
76
+ type XYPadThumbMethods,
77
+ } from './components/XYPad'
17
78
 
18
- export * from './hooks/useAnimationFrame'
19
- export * from './hooks/useDrag'
20
- export * from './hooks/useDragWithElement'
21
- export * from './hooks/useEventListener'
22
- export * from './hooks/useInterval'
23
- export * from './hooks/useLongPress'
79
+ export { useAnimationFrame } from './hooks/useAnimationFrame'
80
+ export { useDrag, type UseDragProps } from './hooks/useDrag'
81
+ export {
82
+ useDragWithElement,
83
+ type UseDragWithElementProps,
84
+ } from './hooks/useDragWithElement'
85
+ export { useEventListener } from './hooks/useEventListener'
86
+ export { useInterval } from './hooks/useInterval'
87
+ export { useLongPress } from './hooks/useLongPress'