@tremolo-ui/react 0.0.6 → 0.0.8

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.
Files changed (133) hide show
  1. package/dist/cjs/index.js +954 -217
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/AnimationCanvas/index.d.ts +16 -9
  4. package/dist/cjs/types/components/AnimationCanvas/index.d.ts.map +1 -1
  5. package/dist/cjs/types/components/AnimationKnob/index.d.ts +53 -0
  6. package/dist/cjs/types/components/AnimationKnob/index.d.ts.map +1 -0
  7. package/dist/cjs/types/components/DragObserver/index.d.ts +19 -0
  8. package/dist/cjs/types/components/DragObserver/index.d.ts.map +1 -0
  9. package/dist/cjs/types/components/Knob/index.d.ts +26 -26
  10. package/dist/cjs/types/components/Knob/index.d.ts.map +1 -1
  11. package/dist/cjs/types/components/NumberInput/index.d.ts +2 -5
  12. package/dist/cjs/types/components/NumberInput/index.d.ts.map +1 -1
  13. package/dist/cjs/types/components/Piano/BlackKey.d.ts +3 -3
  14. package/dist/cjs/types/components/Piano/BlackKey.d.ts.map +1 -1
  15. package/dist/cjs/types/components/Piano/KeyLabel.d.ts +5 -8
  16. package/dist/cjs/types/components/Piano/KeyLabel.d.ts.map +1 -1
  17. package/dist/cjs/types/components/Piano/WhiteKey.d.ts +3 -3
  18. package/dist/cjs/types/components/Piano/WhiteKey.d.ts.map +1 -1
  19. package/dist/cjs/types/components/Piano/index.d.ts +4 -5
  20. package/dist/cjs/types/components/Piano/index.d.ts.map +1 -1
  21. package/dist/cjs/types/components/Piano/key.d.ts +4 -7
  22. package/dist/cjs/types/components/Piano/key.d.ts.map +1 -1
  23. package/dist/cjs/types/components/Piano/keyboardShortcuts.d.ts.map +1 -1
  24. package/dist/cjs/types/components/Slider/Scale.d.ts +11 -0
  25. package/dist/cjs/types/components/Slider/Scale.d.ts.map +1 -0
  26. package/dist/cjs/types/components/Slider/ScaleOption.d.ts +25 -0
  27. package/dist/cjs/types/components/Slider/ScaleOption.d.ts.map +1 -0
  28. package/dist/cjs/types/components/Slider/Thumb.d.ts +5 -13
  29. package/dist/cjs/types/components/Slider/Thumb.d.ts.map +1 -1
  30. package/dist/cjs/types/components/Slider/Track.d.ts +10 -21
  31. package/dist/cjs/types/components/Slider/Track.d.ts.map +1 -1
  32. package/dist/cjs/types/components/Slider/context.d.ts +21 -0
  33. package/dist/cjs/types/components/Slider/context.d.ts.map +1 -0
  34. package/dist/cjs/types/components/Slider/index.d.ts +18 -12
  35. package/dist/cjs/types/components/Slider/index.d.ts.map +1 -1
  36. package/dist/cjs/types/components/WheelObserver/index.d.ts +24 -0
  37. package/dist/cjs/types/components/WheelObserver/index.d.ts.map +1 -0
  38. package/dist/cjs/types/components/XYPad/Area.d.ts +13 -0
  39. package/dist/cjs/types/components/XYPad/Area.d.ts.map +1 -0
  40. package/dist/cjs/types/components/XYPad/Thumb.d.ts +19 -0
  41. package/dist/cjs/types/components/XYPad/Thumb.d.ts.map +1 -0
  42. package/dist/cjs/types/components/XYPad/index.d.ts +39 -0
  43. package/dist/cjs/types/components/XYPad/index.d.ts.map +1 -0
  44. package/dist/cjs/types/hooks/useCallbackRef.d.ts.map +1 -1
  45. package/dist/cjs/types/index.d.ts +11 -0
  46. package/dist/cjs/types/index.d.ts.map +1 -1
  47. package/dist/esm/index.js +932 -218
  48. package/dist/esm/index.js.map +1 -1
  49. package/dist/esm/types/components/AnimationCanvas/index.d.ts +16 -9
  50. package/dist/esm/types/components/AnimationCanvas/index.d.ts.map +1 -1
  51. package/dist/esm/types/components/AnimationKnob/index.d.ts +53 -0
  52. package/dist/esm/types/components/AnimationKnob/index.d.ts.map +1 -0
  53. package/dist/esm/types/components/DragObserver/index.d.ts +19 -0
  54. package/dist/esm/types/components/DragObserver/index.d.ts.map +1 -0
  55. package/dist/esm/types/components/Knob/index.d.ts +26 -26
  56. package/dist/esm/types/components/Knob/index.d.ts.map +1 -1
  57. package/dist/esm/types/components/NumberInput/index.d.ts +2 -5
  58. package/dist/esm/types/components/NumberInput/index.d.ts.map +1 -1
  59. package/dist/esm/types/components/Piano/BlackKey.d.ts +3 -3
  60. package/dist/esm/types/components/Piano/BlackKey.d.ts.map +1 -1
  61. package/dist/esm/types/components/Piano/KeyLabel.d.ts +5 -8
  62. package/dist/esm/types/components/Piano/KeyLabel.d.ts.map +1 -1
  63. package/dist/esm/types/components/Piano/WhiteKey.d.ts +3 -3
  64. package/dist/esm/types/components/Piano/WhiteKey.d.ts.map +1 -1
  65. package/dist/esm/types/components/Piano/index.d.ts +4 -5
  66. package/dist/esm/types/components/Piano/index.d.ts.map +1 -1
  67. package/dist/esm/types/components/Piano/key.d.ts +4 -7
  68. package/dist/esm/types/components/Piano/key.d.ts.map +1 -1
  69. package/dist/esm/types/components/Piano/keyboardShortcuts.d.ts.map +1 -1
  70. package/dist/esm/types/components/Slider/Scale.d.ts +11 -0
  71. package/dist/esm/types/components/Slider/Scale.d.ts.map +1 -0
  72. package/dist/esm/types/components/Slider/ScaleOption.d.ts +25 -0
  73. package/dist/esm/types/components/Slider/ScaleOption.d.ts.map +1 -0
  74. package/dist/esm/types/components/Slider/Thumb.d.ts +5 -13
  75. package/dist/esm/types/components/Slider/Thumb.d.ts.map +1 -1
  76. package/dist/esm/types/components/Slider/Track.d.ts +10 -21
  77. package/dist/esm/types/components/Slider/Track.d.ts.map +1 -1
  78. package/dist/esm/types/components/Slider/context.d.ts +21 -0
  79. package/dist/esm/types/components/Slider/context.d.ts.map +1 -0
  80. package/dist/esm/types/components/Slider/index.d.ts +18 -12
  81. package/dist/esm/types/components/Slider/index.d.ts.map +1 -1
  82. package/dist/esm/types/components/WheelObserver/index.d.ts +24 -0
  83. package/dist/esm/types/components/WheelObserver/index.d.ts.map +1 -0
  84. package/dist/esm/types/components/XYPad/Area.d.ts +13 -0
  85. package/dist/esm/types/components/XYPad/Area.d.ts.map +1 -0
  86. package/dist/esm/types/components/XYPad/Thumb.d.ts +19 -0
  87. package/dist/esm/types/components/XYPad/Thumb.d.ts.map +1 -0
  88. package/dist/esm/types/components/XYPad/index.d.ts +39 -0
  89. package/dist/esm/types/components/XYPad/index.d.ts.map +1 -0
  90. package/dist/esm/types/hooks/useCallbackRef.d.ts.map +1 -1
  91. package/dist/esm/types/index.d.ts +11 -0
  92. package/dist/esm/types/index.d.ts.map +1 -1
  93. package/dist/styles/index.css +241 -0
  94. package/package.json +2 -5
  95. package/src/components/AnimationCanvas/index.tsx +87 -57
  96. package/src/components/AnimationKnob/index.tsx +305 -0
  97. package/src/components/DragObserver/index.tsx +94 -0
  98. package/src/components/Knob/index.css +48 -0
  99. package/src/components/Knob/index.tsx +152 -165
  100. package/src/components/NumberInput/index.css +25 -0
  101. package/src/components/NumberInput/index.tsx +8 -41
  102. package/src/components/Piano/BlackKey.tsx +104 -98
  103. package/src/components/Piano/KeyLabel.tsx +18 -40
  104. package/src/components/Piano/WhiteKey.tsx +92 -87
  105. package/src/components/Piano/index.css +63 -0
  106. package/src/components/Piano/index.tsx +78 -61
  107. package/src/components/Piano/key.ts +4 -7
  108. package/src/components/Piano/keyboardShortcuts.ts +23 -4
  109. package/src/components/Slider/Scale.tsx +55 -0
  110. package/src/components/Slider/ScaleOption.tsx +103 -0
  111. package/src/components/Slider/Thumb.tsx +69 -76
  112. package/src/components/Slider/Track.tsx +37 -48
  113. package/src/components/Slider/context.tsx +66 -0
  114. package/src/components/Slider/index.css +76 -0
  115. package/src/components/Slider/index.tsx +256 -298
  116. package/src/components/WheelObserver/index.tsx +47 -0
  117. package/src/components/XYPad/Area.tsx +40 -0
  118. package/src/components/XYPad/Thumb.tsx +92 -0
  119. package/src/components/XYPad/index.css +24 -0
  120. package/src/components/XYPad/index.tsx +317 -0
  121. package/src/hooks/useCallbackRef.ts +1 -0
  122. package/src/hooks/useRefCallbackEvent.ts +1 -0
  123. package/src/index.ts +12 -0
  124. package/dist/cjs/types/components/Slider/type.d.ts +0 -7
  125. package/dist/cjs/types/components/Slider/type.d.ts.map +0 -1
  126. package/dist/cjs/types/system/pseudo.d.ts +0 -14
  127. package/dist/cjs/types/system/pseudo.d.ts.map +0 -1
  128. package/dist/esm/types/components/Slider/type.d.ts +0 -7
  129. package/dist/esm/types/components/Slider/type.d.ts.map +0 -1
  130. package/dist/esm/types/system/pseudo.d.ts +0 -14
  131. package/dist/esm/types/system/pseudo.d.ts.map +0 -1
  132. package/src/components/Slider/type.ts +0 -16
  133. package/src/system/pseudo.ts +0 -55
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var jsxRuntime = require('@emotion/react/jsx-runtime');
4
- var react = require('@emotion/react');
3
+ var jsxRuntime = require('react/jsx-runtime');
5
4
  var React = require('react');
6
5
 
7
6
  /******************************************************************************
@@ -69,20 +68,17 @@ function setDprConfig(canvas, context, width, height, dpr) {
69
68
  canvas.style.width = `${width}px`;
70
69
  canvas.style.height = `${height}px`;
71
70
  }
72
- /**
73
- * A simple animatable canvas with requestAnimationFrame()
74
- */
75
71
  function AnimationCanvas(_a) {
76
- var { width = 100, height = 100, style, relativeSize = false, reduceFlickering = true, options, init, draw, className } = _a, props = __rest(_a, ["width", "height", "style", "relativeSize", "reduceFlickering", "options", "init", "draw", "className"]);
72
+ var { width = 100, height = 100, relativeSize = false, reduceFlickering = true, options, init, draw, className } = _a, props = __rest(_a, ["width", "height", "relativeSize", "reduceFlickering", "options", "init", "draw", "className"]);
77
73
  const canvasRef = React.useRef(null);
78
74
  const memoCanvasRef = React.useRef(null);
79
75
  const reqIdRef = React.useRef();
80
76
  const widthRef = React.useRef(0);
81
77
  const heightRef = React.useRef(0);
82
- const loop = (context, width, height, count) => {
78
+ const loop = React.useCallback((context, width, height, count) => {
83
79
  reqIdRef.current = requestAnimationFrame(() => loop(context, width, height, count + 1));
84
80
  draw(context, width, height, count + 1);
85
- };
81
+ }, [draw]);
86
82
  React.useEffect(() => {
87
83
  if (!canvasRef.current)
88
84
  return;
@@ -96,30 +92,34 @@ function AnimationCanvas(_a) {
96
92
  if (!parent)
97
93
  throw new Error("Canvas doesn't have a parent element.");
98
94
  const memoCanvas = memoCanvasRef.current;
99
- const memoContext = memoCanvas === null || memoCanvas === undefined ? undefined : memoCanvas.getContext('2d', options);
100
- const resizeObserver = new ResizeObserver(() => {
101
- // console.log('resize')
102
- // Prevents loss of some context when the canvas is resized
103
- const contextMemo = {};
104
- for (const prop of drawingState) {
105
- contextMemo[prop] = context[prop];
106
- }
107
- const w = Math.floor(parent.clientWidth);
108
- const h = Math.floor(parent.clientHeight);
109
- if (reduceFlickering && memoCanvas && memoContext) {
110
- memoCanvas.width = w * dpr;
111
- memoCanvas.height = h * dpr;
112
- memoContext.scale(1 / dpr, 1 / dpr);
113
- memoContext.drawImage(context.canvas, 0, 0);
114
- }
115
- setDprConfig(canvas, context, w, h, dpr);
116
- widthRef.current = w;
117
- heightRef.current = h;
118
- for (const prop of drawingState) {
119
- context[prop] = contextMemo[prop];
120
- }
121
- if (reduceFlickering && memoContext) {
122
- context.drawImage(memoContext.canvas, 0, 0);
95
+ const memoContext = memoCanvas === null || memoCanvas === void 0 ? void 0 : memoCanvas.getContext('2d', options);
96
+ const resizeObserver = new ResizeObserver((entries) => {
97
+ // TODO: If the parent element has no absolute height, the height increases infinitely.
98
+ // : 親要素に絶対的な高さを持たない場合、高さは無限に増加します。
99
+ // https://zenn.dev/megeton/articles/be1c677e174c84#%E6%A0%B9%E6%9C%AC%E7%9A%84%E3%81%AB-resizeobserver-loop-limit-exceeded-%E3%81%8C%E5%87%BA%E3%82%8B%E5%95%8F%E9%A1%8C%E3%81%AB%E5%90%91%E3%81%8D%E5%90%88%E3%81%86
100
+ for (const entry of entries) {
101
+ // Prevents loss of some context when the canvas is resized
102
+ const contextMemo = {};
103
+ for (const prop of drawingState) {
104
+ contextMemo[prop] = context[prop];
105
+ }
106
+ const w = Math.floor(entry.contentRect.width);
107
+ const h = Math.floor(entry.contentRect.height);
108
+ if (reduceFlickering && memoCanvas && memoContext) {
109
+ memoCanvas.width = w * dpr;
110
+ memoCanvas.height = h * dpr;
111
+ memoContext.scale(1 / dpr, 1 / dpr);
112
+ memoContext.drawImage(context.canvas, 0, 0);
113
+ }
114
+ setDprConfig(canvas, context, w, h, dpr);
115
+ widthRef.current = w;
116
+ heightRef.current = h;
117
+ for (const prop of drawingState) {
118
+ context[prop] = contextMemo[prop];
119
+ }
120
+ if (reduceFlickering && memoContext) {
121
+ context.drawImage(memoContext.canvas, 0, 0);
122
+ }
123
123
  }
124
124
  });
125
125
  resizeObserver.observe(parent);
@@ -148,8 +148,8 @@ function AnimationCanvas(_a) {
148
148
  cancelAnimationFrame(reqIdRef.current);
149
149
  };
150
150
  }
151
- }, [loop]);
152
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("canvas", Object.assign({ className: clsx('tremolo-animation-canvas', className), width: relativeSize ? 0 : width, height: relativeSize ? 0 : height, css: react.css(style), ref: canvasRef }, props)), relativeSize && reduceFlickering && (jsxRuntime.jsx("canvas", { style: { display: 'none' }, width: relativeSize ? 0 : width, height: relativeSize ? 0 : height, ref: memoCanvasRef }))] }));
151
+ }, [loop, init, options, reduceFlickering, relativeSize]);
152
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("canvas", Object.assign({ className: clsx('tremolo-animation-canvas', className), width: relativeSize ? 0 : width, height: relativeSize ? 0 : height, ref: canvasRef }, props)), relativeSize && reduceFlickering && (jsxRuntime.jsx("canvas", { style: { display: 'none' }, ref: memoCanvasRef }))] }));
153
153
  }
154
154
 
155
155
  /**
@@ -190,7 +190,7 @@ function stepValue(value, step) {
190
190
  if (step <= 0)
191
191
  throw new RangeError('requirements: step > 0');
192
192
  const quotient = Math.floor(value / step);
193
- const decimalDigits = (_a = decimalPart$1(step)) === null || _a === undefined ? undefined : _a.length;
193
+ const decimalDigits = (_a = decimalPart$1(step)) === null || _a === void 0 ? void 0 : _a.length;
194
194
  const v = toFixed$2(quotient * step, decimalDigits);
195
195
  const next = toFixed$2((quotient + 1) * step, decimalDigits);
196
196
  return Math.abs(value - v) < Math.abs(value - next) ? v : next;
@@ -242,6 +242,81 @@ function styleHelper(value, op, influencer) {
242
242
  }
243
243
  }
244
244
  }
245
+ /**
246
+ * @category Utility
247
+ */
248
+ function mod(n, m) {
249
+ return ((n % m) + m) % m;
250
+ }
251
+ /**
252
+ * @category Utility
253
+ */
254
+ function xor(a = false, b = false) {
255
+ return (a || b) && a != b;
256
+ }
257
+ /**
258
+ * @category MIDI
259
+ */
260
+ const noteNames = [
261
+ 'C',
262
+ 'C#',
263
+ 'D',
264
+ 'D#',
265
+ 'E',
266
+ 'F',
267
+ 'F#',
268
+ 'G',
269
+ 'G#',
270
+ 'A',
271
+ 'A#',
272
+ 'B',
273
+ ];
274
+ /**
275
+ * @category MIDI
276
+ */
277
+ function parseNoteName(noteName) {
278
+ const m = noteName.match(/^([a-g])(#{0,2}|b{0,2})(-?\d+)$/i);
279
+ if (!m)
280
+ throw new Error('Invalid note name');
281
+ const [, letter, accidental, octave] = m;
282
+ return {
283
+ letter: letter.toLocaleUpperCase(),
284
+ accidental: accidental,
285
+ octave: Number(octave),
286
+ };
287
+ }
288
+ /**
289
+ *
290
+ * @category MIDI
291
+ */
292
+ function noteNumber(noteName) {
293
+ const { letter, accidental, octave } = parseNoteName(noteName);
294
+ const noteIndex = noteNames.indexOf(letter.toLocaleUpperCase());
295
+ const accidentalValue = (accidental[0] == 'b' ? -1 : 1) * accidental.length;
296
+ return noteIndex + 12 * (Number(octave) + 1) + accidentalValue;
297
+ }
298
+ /**
299
+ *
300
+ * @category MIDI
301
+ */
302
+ function noteName(noteNumber) {
303
+ const noteIndex = mod(noteNumber, 12);
304
+ const octave = Math.floor(noteNumber / 12) - 1;
305
+ return noteNames[noteIndex] + octave;
306
+ }
307
+ /**
308
+ * @category MIDI
309
+ */
310
+ function isWhiteKey(note) {
311
+ const n = typeof note == 'string' ? noteNumber(note) : note;
312
+ return (mod(n, 12) == 0 ||
313
+ mod(n, 12) == 2 ||
314
+ mod(n, 12) == 4 ||
315
+ mod(n, 12) == 5 ||
316
+ mod(n, 12) == 7 ||
317
+ mod(n, 12) == 9 ||
318
+ mod(n, 12) == 11);
319
+ }
245
320
 
246
321
  /**
247
322
  * This hook is user-land implementation of the experimental `useEffectEvent` hook.
@@ -254,13 +329,14 @@ function useCallbackRef(callback, deps = []) {
254
329
  React.useInsertionEffect(() => {
255
330
  callbackRef.current = callback;
256
331
  });
257
- return React.useCallback((...args) => { var _a; return (_a = callbackRef.current) === null || _a === undefined ? undefined : _a.call(callbackRef, ...args); }, deps);
332
+ // eslint-disable-next-line react-hooks/exhaustive-deps
333
+ return React.useCallback((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }, deps);
258
334
  }
259
335
 
260
336
  function useEventListener(target, event, handler, options) {
261
337
  const listener = useCallbackRef(handler);
262
338
  React.useEffect(() => {
263
- const node = typeof target === 'function' ? target() : (target !== null && target !== undefined ? target : document);
339
+ const node = typeof target === 'function' ? target() : (target !== null && target !== void 0 ? target : document);
264
340
  if (!handler || !node)
265
341
  return;
266
342
  node.addEventListener(event, listener, options);
@@ -269,8 +345,8 @@ function useEventListener(target, event, handler, options) {
269
345
  };
270
346
  }, [event, target, options, listener, handler]);
271
347
  return () => {
272
- const node = typeof target === 'function' ? target() : (target !== null && target !== undefined ? target : document);
273
- node === null || node === undefined ? undefined : node.removeEventListener(event, listener, options);
348
+ const node = typeof target === 'function' ? target() : (target !== null && target !== void 0 ? target : document);
349
+ node === null || node === void 0 ? void 0 : node.removeEventListener(event, listener, options);
274
350
  };
275
351
  }
276
352
 
@@ -279,7 +355,7 @@ function useRefCallbackEvent(event, handler, options, deps = []) {
279
355
  let cleanup;
280
356
  return (node) => {
281
357
  if (!node) {
282
- cleanup === null || cleanup === undefined ? undefined : cleanup();
358
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
283
359
  return;
284
360
  }
285
361
  node.addEventListener(event, handler, options);
@@ -287,6 +363,7 @@ function useRefCallbackEvent(event, handler, options, deps = []) {
287
363
  node.removeEventListener(event, handler, options);
288
364
  };
289
365
  };
366
+ // eslint-disable-next-line react-hooks/exhaustive-deps
290
367
  }, deps);
291
368
  }
292
369
 
@@ -297,34 +374,17 @@ function removeNoSelect() {
297
374
  document.body.classList.remove('tremolo-no-select');
298
375
  }
299
376
 
300
- const defaultOptions = {
301
- active: '#7998ec',
302
- inactive: '#eee',
303
- bg: '#ccc',
304
- thumb: '#4e76e6',
305
- lineWeight: 6,
306
- thumbWeight: 4,
307
- };
308
377
  /**
309
378
  * simple rotary Knob.
310
379
  */
311
- function Knob(_a) {
312
- var { value, min, max, defaultValue = min, startValue = min, step = 1, skew = 1, size, width = 50, height = 50, options = defaultOptions, draw, bodyNoSelect = true, wheel, enableDoubleClickDefault = true, style, className, onChange, _active, _focus, _hover } = _a, props = __rest(_a, ["value", "min", "max", "defaultValue", "startValue", "step", "skew", "size", "width", "height", "options", "draw", "bodyNoSelect", "wheel", "enableDoubleClickDefault", "style", "className", "onChange", "_active", "_focus", "_hover"]);
380
+ function AnimationKnob(_a) {
381
+ var { value, min, max, defaultValue = min, startValue = min, step = 1, skew = 1, size, width = 50, height = 50, activeColor = '#7998ec', inactiveColor = '#eee', bg = '#ccc', thumb = '#4e76e6', lineWeight = 6, thumbWeight = 4, draw, bodyNoSelect = true, wheel = ['raw', 1], keyboard = ['raw', 1], enableDoubleClickDefault = true, style, className, onChange } = _a, props = __rest(_a, ["value", "min", "max", "defaultValue", "startValue", "step", "skew", "size", "width", "height", "activeColor", "inactiveColor", "bg", "thumb", "lineWeight", "thumbWeight", "draw", "bodyNoSelect", "wheel", "keyboard", "enableDoubleClickDefault", "style", "className", "onChange"]);
313
382
  // -- state and ref ---
314
383
  // const [privateValue, setPrivateValue] = useState(value);
315
384
  const dragOffsetY = React.useRef(undefined);
316
385
  // --- interpret props ---
317
- const opts = Object.assign(Object.assign({}, defaultOptions), options);
318
386
  // const percent = normalizeValue(value, min, max, skew)
319
- const isRelativeSize = typeof (size !== null && size !== undefined ? size : width) == 'string';
320
- const adaptSize = (size) => {
321
- if (typeof size == 'string') {
322
- return Number(size.slice(0, -1));
323
- }
324
- else {
325
- return size;
326
- }
327
- };
387
+ const isRelativeSize = typeof (size !== null && size !== void 0 ? size : width) == 'string' || typeof height == 'string';
328
388
  const handleEvent = (event) => {
329
389
  const isTouch = event instanceof TouchEvent;
330
390
  if (isTouch && event.cancelable)
@@ -334,6 +394,8 @@ function Knob(_a) {
334
394
  addNoSelect();
335
395
  const screenY = isTouch ? event.touches[0].screenY : event.screenY;
336
396
  const delta = dragOffsetY.current - screenY;
397
+ if (Math.abs(delta) < 1)
398
+ return;
337
399
  dragOffsetY.current = screenY;
338
400
  const n = normalizeValue(value, min, max, skew);
339
401
  const v = rawValue(n + delta / 100, min, max, skew);
@@ -342,6 +404,24 @@ function Knob(_a) {
342
404
  onChange(v2);
343
405
  }
344
406
  };
407
+ const handleKeyDown = React.useCallback((event) => {
408
+ if (!keyboard || !onChange)
409
+ return;
410
+ const key = event.key;
411
+ if (['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'].includes(key)) {
412
+ event.preventDefault();
413
+ const x = key == 'ArrowRight' || key == 'ArrowUp' ? keyboard[1] : -keyboard[1];
414
+ let v;
415
+ if (keyboard[0] == 'normalized') {
416
+ const n = normalizeValue(value, min, max, skew);
417
+ v = rawValue(n + x, min, max, skew);
418
+ }
419
+ else {
420
+ v = value + x;
421
+ }
422
+ onChange(clamp(stepValue(v, step), min, max));
423
+ }
424
+ }, [value, min, max, step, skew, keyboard, onChange]);
345
425
  // --- hooks ---
346
426
  const wheelRefCallback = useRefCallbackEvent('wheel', (event) => {
347
427
  if (!wheel)
@@ -366,24 +446,24 @@ function Knob(_a) {
366
446
  if (bodyNoSelect)
367
447
  removeNoSelect();
368
448
  });
369
- return (jsxRuntime.jsxs("div", Object.assign({ className: clsx('tremolo-knob', className), ref: (div) => {
449
+ return (jsxRuntime.jsx("div", Object.assign({ className: clsx('tremolo-animation-knob', className), ref: (div) => {
370
450
  wheelRefCallback(div);
371
451
  touchMoveRefCallback(div);
372
- }, role: "slider", tabIndex: 0, "aria-valuenow": value, "aria-valuemax": max, "aria-valuemin": min, css: react.css(Object.assign(Object.assign({ display: 'inline-block', width: size !== null && size !== undefined ? size : width, height: size !== null && size !== undefined ? size : height, cursor: 'pointer' }, style), { ':active': Object.assign({}, _active), ':focus': Object.assign({}, _focus), ':hover': Object.assign({}, _hover) })), onPointerDown: (event) => {
452
+ }, role: "slider", tabIndex: 0, "aria-valuenow": value, "aria-valuemax": max, "aria-valuemin": min, style: Object.assign({ display: 'inline-block', width: size !== null && size !== void 0 ? size : width, height: size !== null && size !== void 0 ? size : height, cursor: 'pointer', WebkitTapHighlightColor: 'transparent' }, style), onPointerDown: (event) => {
373
453
  dragOffsetY.current = event.screenY;
374
454
  handleEvent(event);
375
455
  }, onDoubleClick: () => {
376
456
  if (enableDoubleClickDefault && onChange) {
377
457
  onChange(defaultValue);
378
458
  }
379
- } }, props, { children: [jsxRuntime.jsx(react.Global, { styles: {
380
- '.no-select': {
381
- userSelect: 'none',
382
- },
383
- } }), jsxRuntime.jsx(AnimationCanvas, { width: adaptSize(size !== null && size !== undefined ? size : width), height: adaptSize(size !== null && size !== undefined ? size : height), relativeSize: isRelativeSize,
384
- // TODO
385
- // reduceFlickering={false}
386
- draw: draw ? draw : (ctx, width, height) => {
459
+ }, onKeyDown: handleKeyDown, onContextMenu: (e) => e.preventDefault() }, props, { children: jsxRuntime.jsx(AnimationCanvas, Object.assign({}, (isRelativeSize
460
+ ? { relativeSize: true }
461
+ : {
462
+ width: size !== null && size !== void 0 ? size : width,
463
+ height: size !== null && size !== void 0 ? size : height,
464
+ }), { draw: draw
465
+ ? draw
466
+ : (ctx, width, height) => {
387
467
  const p = normalizeValue(value, min, max, skew);
388
468
  const startP = normalizeValue(startValue, min, max, skew);
389
469
  const w = width.current, cx = w / 2;
@@ -396,33 +476,172 @@ function Knob(_a) {
396
476
  ctx.lineCap = 'butt';
397
477
  // bg
398
478
  ctx.beginPath();
399
- ctx.fillStyle = opts.bg;
479
+ ctx.fillStyle = bg;
400
480
  ctx.arc(cx, cy, r - 0.5, 0, 2 * Math.PI);
401
481
  ctx.fill();
402
- ctx.lineCap = 'round';
403
- ctx.lineWidth = opts.lineWeight;
482
+ ctx.lineWidth = lineWeight;
404
483
  // inactive rotary
405
484
  ctx.beginPath();
406
- ctx.strokeStyle = opts.inactive;
407
- ctx.arc(cx, cy, r - 0.5 - opts.lineWeight / 2, radian(135), radian(45));
485
+ ctx.strokeStyle = inactiveColor;
486
+ ctx.arc(cx, cy, r - 0.5 - lineWeight / 2, radian(135), radian(45));
408
487
  ctx.stroke();
409
488
  // active rotary
410
489
  ctx.beginPath();
411
- ctx.strokeStyle = opts.active;
412
- ctx.arc(cx, cy, r - 0.5 - opts.lineWeight / 2, radian(135 + 270 * startP), radian(135 + 270 * p), p < startP);
490
+ ctx.strokeStyle = activeColor;
491
+ ctx.arc(cx, cy, r - 0.5 - lineWeight / 2, radian(135 + 270 * startP), radian(135 + 270 * p), p < startP);
413
492
  ctx.stroke();
414
493
  // thumb
494
+ ctx.lineCap = 'round';
415
495
  ctx.beginPath();
416
496
  ctx.moveTo(cx, cy);
417
497
  ctx.lineTo(cx +
418
498
  Math.cos(radian(135 + 270 * p)) *
419
- (r - 0.5 - opts.thumbWeight / 2), cy +
499
+ (r - 0.5 - thumbWeight / 2), cy +
420
500
  Math.sin(radian(135 + 270 * p)) *
421
- (r - 0.5 - opts.thumbWeight / 2));
422
- ctx.strokeStyle = opts.thumb;
423
- ctx.lineWidth = opts.thumbWeight;
501
+ (r - 0.5 - thumbWeight / 2));
502
+ ctx.strokeStyle = thumb;
503
+ ctx.lineWidth = thumbWeight;
424
504
  ctx.stroke();
425
- } })] })));
505
+ } })) })));
506
+ }
507
+
508
+ function DragObserver(props) {
509
+ const { children, onDrag, onDragStart, onDragEnd, as: Component = 'div' } = props, attributes = __rest(props, ["children", "onDrag", "onDragStart", "onDragEnd", "as"]);
510
+ const dragOffsetX = React.useRef(undefined);
511
+ const dragOffsetY = React.useRef(undefined);
512
+ const handleEvent = (event) => {
513
+ const isTouch = event instanceof TouchEvent;
514
+ if (isTouch && event.cancelable)
515
+ event.preventDefault();
516
+ const screenX = isTouch ? event.touches[0].screenX : event.screenX;
517
+ const screenY = isTouch ? event.touches[0].screenY : event.screenY;
518
+ let deltaX = 0, deltaY = 0;
519
+ if (dragOffsetX.current) {
520
+ deltaX = screenX - dragOffsetX.current;
521
+ dragOffsetX.current = screenX;
522
+ }
523
+ if (dragOffsetY.current) {
524
+ deltaY = screenY - dragOffsetY.current;
525
+ dragOffsetY.current = screenY;
526
+ }
527
+ if (Math.abs(deltaX) < 1 && Math.abs(deltaY) < 1)
528
+ return;
529
+ if (onDrag)
530
+ onDrag(deltaX, deltaY);
531
+ };
532
+ const touchMoveRefCallback = useRefCallbackEvent('touchmove', handleEvent, { passive: false }, [onDrag]);
533
+ useEventListener(window, 'mousemove', handleEvent);
534
+ useEventListener(window, 'pointerup', () => {
535
+ dragOffsetX.current = undefined;
536
+ dragOffsetY.current = undefined;
537
+ onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd();
538
+ });
539
+ return (jsxRuntime.jsx(Component, Object.assign({ ref: touchMoveRefCallback, onPointerDown: (event) => {
540
+ dragOffsetX.current = event.screenX;
541
+ dragOffsetY.current = event.screenY;
542
+ handleEvent(event);
543
+ onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart();
544
+ } }, attributes, { children: children })));
545
+ }
546
+
547
+ function Knob(_a) {
548
+ var { value, min, max, step = 1, skew = 1, defaultValue = min, startValue = min, size = 50, bodyNoSelect = true, wheel = ['raw', 1], keyboard = ['raw', 1], enableDoubleClickDefault = true, disabled = false, readonly = false, activeLine, inactiveLine, thumb, thumbLine, onChange, className, classes } = _a, props = __rest(_a, ["value", "min", "max", "step", "skew", "defaultValue", "startValue", "size", "bodyNoSelect", "wheel", "keyboard", "enableDoubleClickDefault", "disabled", "readonly", "activeLine", "inactiveLine", "thumb", "thumbLine", "onChange", "className", "classes"]);
549
+ // -- state and ref ---
550
+ const dragOffsetY = React.useRef(undefined);
551
+ // --- interpret props ---
552
+ const padding = 8; // %
553
+ const thumbLineWeight = 6; // %
554
+ const thumbLength = 35; // %
555
+ const lineWeight = 3; // px
556
+ const p = normalizeValue(value, min, max, skew);
557
+ const s = normalizeValue(startValue, min, max, skew);
558
+ // --- internal functions ---
559
+ const handleEvent = (event) => {
560
+ if (!onChange || readonly)
561
+ return;
562
+ const isTouch = event instanceof TouchEvent;
563
+ if (isTouch && event.cancelable)
564
+ event.preventDefault();
565
+ if (dragOffsetY.current) {
566
+ if (bodyNoSelect)
567
+ addNoSelect();
568
+ const screenY = isTouch ? event.touches[0].screenY : event.screenY;
569
+ const delta = dragOffsetY.current - screenY;
570
+ if (Math.abs(delta) < 1)
571
+ return;
572
+ dragOffsetY.current = screenY;
573
+ const n = normalizeValue(value, min, max, skew);
574
+ const v = rawValue(n + delta / 100, min, max, skew);
575
+ const v2 = clamp(stepValue(v, step), min, max);
576
+ onChange(v2);
577
+ }
578
+ };
579
+ const handleKeyDown = React.useCallback((event) => {
580
+ if (!keyboard || !onChange || readonly)
581
+ return;
582
+ const key = event.key;
583
+ if (['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'].includes(key)) {
584
+ event.preventDefault();
585
+ const x = key == 'ArrowRight' || key == 'ArrowUp' ? keyboard[1] : -keyboard[1];
586
+ let v;
587
+ if (keyboard[0] == 'normalized') {
588
+ const n = normalizeValue(value, min, max, skew);
589
+ v = rawValue(n + x, min, max, skew);
590
+ }
591
+ else {
592
+ v = value + x;
593
+ }
594
+ onChange(clamp(stepValue(v, step), min, max));
595
+ }
596
+ }, [value, min, max, step, skew, keyboard, readonly, onChange]);
597
+ // --- hooks ---
598
+ const wheelRefCallback = useRefCallbackEvent('wheel', (event) => {
599
+ if (!wheel)
600
+ return;
601
+ event.preventDefault();
602
+ const x = event.deltaY > 0 ? -wheel[1] : wheel[1];
603
+ let v;
604
+ if (wheel[0] == 'normalized') {
605
+ const n = normalizeValue(value, min, max, skew);
606
+ v = rawValue(n + x, min, max, skew);
607
+ }
608
+ else {
609
+ v = value + x;
610
+ }
611
+ if (onChange)
612
+ onChange(clamp(stepValue(v, step), min, max));
613
+ }, { passive: false }, [wheel, value, min, max, skew, step, onChange]);
614
+ const touchMoveRefCallback = useRefCallbackEvent('touchmove', handleEvent, { passive: false }, [value, min, max, skew, step, onChange, bodyNoSelect]);
615
+ useEventListener(window, 'mousemove', handleEvent);
616
+ useEventListener(window, 'pointerup', () => {
617
+ dragOffsetY.current = undefined;
618
+ if (bodyNoSelect)
619
+ removeNoSelect();
620
+ });
621
+ const center = size / 2;
622
+ const r1 = -135;
623
+ const r2 = -135 + Math.min(p, s) * 270;
624
+ const r3 = -135 + Math.max(p, s) * 270;
625
+ const r4 = 135;
626
+ const x1 = center + center * Math.cos(radian(r1 - 90));
627
+ const y1 = center + center * Math.sin(radian(r1 - 90));
628
+ const x2 = center + center * Math.cos(radian(r2 - 90));
629
+ const y2 = center + center * Math.sin(radian(r2 - 90));
630
+ const x3 = center + center * Math.cos(radian(r3 - 90));
631
+ const y3 = center + center * Math.sin(radian(r3 - 90));
632
+ const x4 = center + center * Math.cos(radian(r4 - 90));
633
+ const y4 = center + center * Math.sin(radian(r4 - 90));
634
+ return (jsxRuntime.jsxs("svg", Object.assign({ className: clsx('tremolo-knob', className), ref: (div) => {
635
+ wheelRefCallback(div);
636
+ touchMoveRefCallback(div);
637
+ }, width: size, height: size, tabIndex: 0, "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, "aria-disabled": disabled, "aria-readonly": readonly, onPointerDown: (event) => {
638
+ dragOffsetY.current = event.screenY;
639
+ handleEvent(event);
640
+ }, onDoubleClick: () => {
641
+ if (enableDoubleClickDefault && onChange) {
642
+ onChange(defaultValue);
643
+ }
644
+ }, onKeyDown: handleKeyDown, onContextMenu: (e) => e.preventDefault() }, props, { children: [startValue > min && (jsxRuntime.jsx("path", { className: clsx('tremolo-knob-inactive-line', classes === null || classes === void 0 ? void 0 : classes.inactiveLine), d: `M ${x1} ${y1} A ${center} ${center} -135 ${r2 - r1 > 180 ? 1 : 0} 1 ${x2}, ${y2}`, fill: "none", stroke: inactiveLine || 'currentColor', strokeWidth: lineWeight })), jsxRuntime.jsx("path", { className: clsx('tremolo-knob-active-line', classes === null || classes === void 0 ? void 0 : classes.activeLine), d: `M ${x2} ${y2} A ${center} ${center} -135 ${r3 - r2 > 180 ? 1 : 0} 1 ${x3}, ${y3}`, fill: "none", stroke: activeLine || 'currentColor', strokeWidth: lineWeight }), startValue < max && (jsxRuntime.jsx("path", { className: clsx('tremolo-knob-inactive-line', classes === null || classes === void 0 ? void 0 : classes.inactiveLine), d: `M ${x3} ${y3} A ${center} ${center} -135 ${r4 - r3 > 180 ? 1 : 0} 1 ${x4}, ${y4}`, fill: "none", stroke: inactiveLine || 'currentColor', strokeWidth: lineWeight })), jsxRuntime.jsxs("svg", { className: clsx('tremolo-knob-thumb', classes === null || classes === void 0 ? void 0 : classes.thumb), children: [jsxRuntime.jsx("circle", { cx: "50%", cy: "50%", r: `${50 - padding}%`, fill: thumb || 'currentColor' }), jsxRuntime.jsx("line", { className: clsx('tremolo-knob-thumb-line', classes === null || classes === void 0 ? void 0 : classes.thumbLine), x1: "50%", y1: `${padding}%`, x2: "50%", y2: `${thumbLength}%`, stroke: thumbLine || 'currentColor', strokeWidth: `${thumbLineWeight}%`, transform: `rotate(${ -135 + p * 270})`, "transform-origin": "50% 50%" })] })] })));
426
645
  }
427
646
 
428
647
  /**
@@ -439,7 +658,7 @@ function toFixed$1(x, fractionDigits) {
439
658
 
440
659
  /**
441
660
  * @module NumberInput
442
- */
661
+ */
443
662
  function selectUnit(units, value) {
444
663
  if (typeof units == 'string')
445
664
  return [units, 1];
@@ -502,14 +721,13 @@ function parseValue(inputString, units, digit, defaultValue = 0) {
502
721
  * Input with some useful functions for entering numerical values.
503
722
  */
504
723
  function NumberInput(_a) {
505
- var { value, min, max, step, defaultValue = min, units, disabled = false, placeholder, readOnly, tabIndex, typeNumber = false, digit, selectWithFocus = 'none', blurWithEnter = true, className, style, onChange, onFocus, onBlur } = _a, props = __rest(_a, ["value", "min", "max", "step", "defaultValue", "units", "disabled", "placeholder", "readOnly", "tabIndex", "typeNumber", "digit", "selectWithFocus", "blurWithEnter", "className", "style", "onChange", "onFocus", "onBlur"]);
724
+ var { value, min, max, step, defaultValue = min, units, disabled = false, placeholder, readOnly, tabIndex, typeNumber = false, digit, selectWithFocus = 'none', blurWithEnter = true, className, onChange, onFocus, onBlur } = _a, props = __rest(_a, ["value", "min", "max", "step", "defaultValue", "units", "disabled", "placeholder", "readOnly", "tabIndex", "typeNumber", "digit", "selectWithFocus", "blurWithEnter", "className", "onChange", "onFocus", "onBlur"]);
506
725
  const [showValue, setShowValue] = React.useState(parseValue(String(value), units, digit, defaultValue).formatValue);
507
726
  const calculatedTypeNumber = units ? false : typeNumber;
508
- const { _active, _focus, _hover } = props, rest = __rest(props, ["_active", "_focus", "_hover"]);
509
- return (jsxRuntime.jsx("input", Object.assign({ className: clsx('tremolo-number-input', className), value: showValue, min: min, max: max, step: step, type: calculatedTypeNumber ? 'number' : 'text', spellCheck: 'false', disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, css: react.css(Object.assign(Object.assign({ display: 'inline-block', font: 'inherit', margin: 0, paddingTop: 6, paddingBottom: 6, paddingLeft: 10, paddingRight: 10, borderStyle: 'solid', borderWidth: 1, borderColor: '#bbb', borderRadius: 4, outline: 0, transition: 'all 0.1s linear', appearance: 'textfield', '&:hover': Object.assign({ borderColor: 'var(--tremolo-theme-color)' }, _hover), '&:focus': Object.assign({ borderColor: 'var(--tremolo-theme-color)', boxShadow: '0px 0px 0px 2px rgba(var(--tremolo-theme-color-rgb), 0.1)' }, _focus) }, (_active && { '&:active': Object.assign({}, _active) })), style)), onChange: (event) => {
727
+ return (jsxRuntime.jsx("input", Object.assign({ className: clsx('tremolo-number-input', className), value: showValue, min: min, max: max, step: step, type: calculatedTypeNumber ? 'number' : 'text', spellCheck: 'false', disabled: disabled, placeholder: placeholder, readOnly: readOnly, tabIndex: tabIndex, onChange: (event) => {
510
728
  const v = event.currentTarget.value;
511
729
  setShowValue(v);
512
- const newValue = clamp(parseValue(v, units, digit, defaultValue).rawValue, min !== null && min !== undefined ? min : -Infinity, max !== null && max !== undefined ? max : Infinity);
730
+ const newValue = clamp(parseValue(v, units, digit, defaultValue).rawValue, min !== null && min !== void 0 ? min : -Infinity, max !== null && max !== void 0 ? max : Infinity);
513
731
  if (onChange)
514
732
  onChange(newValue, event);
515
733
  }, onFocus: (event) => {
@@ -534,9 +752,314 @@ function NumberInput(_a) {
534
752
  if (blurWithEnter && event.key == 'Enter') {
535
753
  event.currentTarget.blur();
536
754
  }
537
- } }, rest)));
755
+ } }, props)));
756
+ }
757
+
758
+ function KeyLabel(_a) {
759
+ var { label, className, wrapperClassName, wrapperStyle, __note, __index, __label } = _a, props = __rest(_a, ["label", "className", "wrapperClassName", "wrapperStyle", "__note", "__index", "__label"]);
760
+ const content = label
761
+ ? label(__note, __index)
762
+ : __label && __label(__note, __index);
763
+ return ((content != undefined || content != null) && (jsxRuntime.jsx("div", { className: clsx('tremolo-piano-key-label-wrapper', wrapperClassName), style: wrapperStyle, children: jsxRuntime.jsx("div", Object.assign({ className: clsx('tremolo-piano-key-label', className) }, props, { children: content })) })));
764
+ }
765
+
766
+ const BlackKey = React.forwardRef((_a, ref) => {
767
+ var { width = 40 * 0.65, height = '60%', className, style, children, __glissando, __position, __note, __disabled, __index, __fill, __width, __playNote, __stopNote, __label } = _a, props = __rest(_a, ["width", "height", "className", "style", "children", "__glissando", "__position", "__note", "__disabled", "__index", "__fill", "__width", "__playNote", "__stopNote", "__label"]);
768
+ const [played, setPlayed] = React.useState(false);
769
+ React.useImperativeHandle(ref, () => {
770
+ return {
771
+ play() {
772
+ if (__disabled)
773
+ return;
774
+ setPlayed(true);
775
+ if (__playNote)
776
+ __playNote(__note);
777
+ },
778
+ stop() {
779
+ setPlayed(false);
780
+ if (__stopNote)
781
+ __stopNote(__note);
782
+ },
783
+ played() {
784
+ return played;
785
+ },
786
+ };
787
+ }, [__disabled, __note, __playNote, __stopNote, played]);
788
+ let keyLabelProps = {};
789
+ if (children != undefined) {
790
+ React.Children.forEach(children, (child) => {
791
+ if (React.isValidElement(child)) {
792
+ if (child.type == KeyLabel) {
793
+ keyLabelProps = child.props;
794
+ }
795
+ else {
796
+ throw new Error('only <KeyLabel>');
797
+ }
798
+ }
799
+ else {
800
+ throw new Error('children is an invalid element.');
801
+ }
802
+ });
803
+ }
804
+ return (jsxRuntime.jsx("div", Object.assign({ className: clsx(`tremolo-piano-black-key`, className), "aria-disabled": __disabled, "data-active": played, style: Object.assign({ left: __position, width: __fill ? __width : (width !== null && width !== void 0 ? width : __width), height: height }, style), onPointerDown: () => {
805
+ if (__disabled)
806
+ return;
807
+ setPlayed(true);
808
+ if (__playNote)
809
+ __playNote(__note);
810
+ }, onPointerEnter: () => {
811
+ if (__disabled)
812
+ return;
813
+ if (__glissando) {
814
+ setPlayed(true);
815
+ if (__playNote)
816
+ __playNote(__note);
817
+ }
818
+ }, onPointerUp: () => {
819
+ if (__disabled)
820
+ return;
821
+ setPlayed(false);
822
+ if (__stopNote)
823
+ __stopNote(__note);
824
+ }, onPointerLeave: () => {
825
+ if (__disabled)
826
+ return;
827
+ setPlayed(false);
828
+ if (__stopNote)
829
+ __stopNote(__note);
830
+ } }, props, { children: jsxRuntime.jsx(KeyLabel, Object.assign({ __note: __note, __label: __label, __index: __index }, keyLabelProps)) })));
831
+ });
832
+
833
+ const WhiteKey = React.forwardRef((_a, ref) => {
834
+ var { width = 40, height = '100%', className, style, children, __glissando, __position, __note, __disabled, __index, __fill, __width, __playNote, __stopNote, __label } = _a, props = __rest(_a, ["width", "height", "className", "style", "children", "__glissando", "__position", "__note", "__disabled", "__index", "__fill", "__width", "__playNote", "__stopNote", "__label"]);
835
+ const [played, setPlayed] = React.useState(false);
836
+ React.useImperativeHandle(ref, () => {
837
+ return {
838
+ play() {
839
+ if (__disabled)
840
+ return;
841
+ setPlayed(true);
842
+ if (__playNote)
843
+ __playNote(__note);
844
+ },
845
+ stop() {
846
+ setPlayed(false);
847
+ if (__stopNote)
848
+ __stopNote(__note);
849
+ },
850
+ played() {
851
+ return played;
852
+ },
853
+ };
854
+ }, [__disabled, __note, __playNote, __stopNote, played]);
855
+ let keyLabelProps = {};
856
+ if (children != undefined) {
857
+ React.Children.forEach(children, (child) => {
858
+ if (React.isValidElement(child)) {
859
+ if (child.type == KeyLabel) {
860
+ keyLabelProps = child.props;
861
+ }
862
+ else {
863
+ throw new Error('only <KeyLabel>');
864
+ }
865
+ }
866
+ else {
867
+ throw new Error('children is an invalid element.');
868
+ }
869
+ });
870
+ }
871
+ return (jsxRuntime.jsx("div", Object.assign({ className: clsx(`tremolo-piano-white-key`, className), "aria-disabled": __disabled, "data-active": played, style: Object.assign({ left: __position, width: __fill ? __width : (width !== null && width !== void 0 ? width : __width), height: height }, style), onPointerDown: () => {
872
+ if (__disabled)
873
+ return;
874
+ setPlayed(true);
875
+ if (__playNote)
876
+ __playNote(__note);
877
+ }, onPointerEnter: () => {
878
+ if (__disabled)
879
+ return;
880
+ if (__glissando) {
881
+ setPlayed(true);
882
+ if (__playNote)
883
+ __playNote(__note);
884
+ }
885
+ }, onPointerUp: () => {
886
+ if (__disabled)
887
+ return;
888
+ setPlayed(false);
889
+ if (__stopNote)
890
+ __stopNote(__note);
891
+ }, onPointerLeave: () => {
892
+ if (__disabled)
893
+ return;
894
+ setPlayed(false);
895
+ if (__stopNote)
896
+ __stopNote(__note);
897
+ } }, props, { children: jsxRuntime.jsx(KeyLabel, Object.assign({ __note: __note, __label: __label, __index: __index }, keyLabelProps)) })));
898
+ });
899
+
900
+ const Shortcuts = {
901
+ HOME_ROW: {
902
+ keys: [
903
+ 'a',
904
+ 'w',
905
+ 's',
906
+ 'e',
907
+ 'd',
908
+ 'f',
909
+ 't',
910
+ 'g',
911
+ 'y',
912
+ 'h',
913
+ 'u',
914
+ 'j',
915
+ 'k',
916
+ 'o',
917
+ 'l',
918
+ 'p',
919
+ ';',
920
+ ],
921
+ },
922
+ };
923
+
924
+ function Piano(_a) {
925
+ var { noteRange, glissando = true, midiMax = 127, keyboardShortcuts, fill = false, height = fill ? '100%' : 160, style, className, playNote, stopNote, label, children } = _a, props = __rest(_a, ["noteRange", "glissando", "midiMax", "keyboardShortcuts", "fill", "height", "style", "className", "playNote", "stopNote", "label", "children"]);
926
+ // -- state and ref ---
927
+ const [pressed, setPressed] = React.useState(false);
928
+ const [whiteNoteWidth, setWhiteNoteWidth] = React.useState(-1);
929
+ const keyRefs = React.useRef([]);
930
+ for (let i = 0; i < noteRange.last - noteRange.first + 1; i++) {
931
+ keyRefs.current[i] = React.createRef();
932
+ }
933
+ const pianoRef = React.useRef(null);
934
+ // --- interpret props ---
935
+ const noteRangeArray = Array.from({ length: noteRange.last - noteRange.first + 1 }, (_, i) => i + noteRange.first);
936
+ const whiteNoteCount = noteRangeArray.filter((v) => isWhiteKey(v)).length;
937
+ let whiteKeyProps = {}, blackKeyProps = {};
938
+ if (children != undefined) {
939
+ React.Children.forEach(children, (child) => {
940
+ if (React.isValidElement(child)) {
941
+ if (child.type == WhiteKey) {
942
+ whiteKeyProps = child.props;
943
+ }
944
+ else if (child.type == BlackKey) {
945
+ blackKeyProps = child.props;
946
+ }
947
+ else {
948
+ throw new Error('only <WhiteKey> or <BlackKey>');
949
+ }
950
+ }
951
+ else {
952
+ throw new Error('children is an invalid element.');
953
+ }
954
+ });
955
+ }
956
+ // --- internal functions ---
957
+ function notePosition(note) {
958
+ const pitchPositions = {
959
+ C: 0,
960
+ 'C#': 0.55,
961
+ D: 1,
962
+ 'D#': 1.8,
963
+ E: 2,
964
+ F: 3,
965
+ 'F#': 3.5,
966
+ G: 4,
967
+ 'G#': 4.7,
968
+ A: 5,
969
+ 'A#': 5.85,
970
+ B: 6,
971
+ };
972
+ const toNoteName = (n) => {
973
+ const { letter, accidental } = parseNoteName(noteName(n));
974
+ return (letter + accidental);
975
+ };
976
+ const _noteName = toNoteName(note);
977
+ const firstNoteName = toNoteName(noteRange.first);
978
+ const pos = pitchPositions[_noteName] - pitchPositions[firstNoteName];
979
+ const octave = Math.floor((note - noteRange.first) / 12);
980
+ const octaveOffset = noteNames.indexOf(firstNoteName) > noteNames.indexOf(_noteName) ? 1 : 0;
981
+ const length = whiteNoteWidth + 3;
982
+ return pos * length + (octave + octaveOffset) * 7 * length;
983
+ }
984
+ // --- hooks ---
985
+ React.useEffect(() => {
986
+ if (fill && pianoRef.current) {
987
+ const parent = pianoRef.current.parentElement;
988
+ if (!parent)
989
+ throw new Error("doesn't have a parent element.");
990
+ const resizeObserver = new ResizeObserver(() => {
991
+ const w = pianoRef.current.clientWidth;
992
+ setWhiteNoteWidth(w / whiteNoteCount - 3);
993
+ });
994
+ resizeObserver.observe(parent);
995
+ }
996
+ else {
997
+ setWhiteNoteWidth((whiteKeyProps === null || whiteKeyProps === void 0 ? void 0 : whiteKeyProps.width) || 40);
998
+ }
999
+ }, [fill, whiteKeyProps === null || whiteKeyProps === void 0 ? void 0 : whiteKeyProps.width, whiteNoteCount]);
1000
+ useEventListener(window, 'keydown', (e) => {
1001
+ var _a, _b, _c, _d;
1002
+ if (e.repeat)
1003
+ return;
1004
+ if (!keyboardShortcuts)
1005
+ return;
1006
+ const index = keyboardShortcuts.keys.indexOf(e.key);
1007
+ if (index != -1) {
1008
+ if (!((_b = (_a = keyRefs.current[index]) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.played())) {
1009
+ (_d = (_c = keyRefs.current[index]) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.play();
1010
+ }
1011
+ }
1012
+ });
1013
+ useEventListener(window, 'keyup', (e) => {
1014
+ var _a, _b;
1015
+ if (e.repeat)
1016
+ return;
1017
+ if (!keyboardShortcuts)
1018
+ return;
1019
+ const index = keyboardShortcuts.keys.indexOf(e.key);
1020
+ if (index != -1) {
1021
+ (_b = (_a = keyRefs.current[index]) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.stop();
1022
+ }
1023
+ });
1024
+ return (jsxRuntime.jsx("div", Object.assign({ ref: pianoRef, className: clsx('tremolo-piano', className), style: Object.assign({ width: fill ? '100%' : undefined, height: height }, style), onPointerDown: (e) => {
1025
+ if (props.onPointerDown)
1026
+ props.onPointerDown(e);
1027
+ setPressed(true);
1028
+ }, onPointerUp: (e) => {
1029
+ if (props.onPointerUp)
1030
+ props.onPointerUp(e);
1031
+ setPressed(false);
1032
+ } }, props, { children: noteRangeArray.map((note, index) => {
1033
+ return isWhiteKey(note) ? (jsxRuntime.jsx(WhiteKey, Object.assign({ ref: keyRefs.current[index], __glissando: glissando && pressed, __position: notePosition(note), __note: note, __disabled: note > midiMax, __index: index, __fill: fill, __width: whiteNoteWidth, __playNote: playNote, __stopNote: stopNote, __label: label }, whiteKeyProps), note)) : (jsxRuntime.jsx(BlackKey, Object.assign({ ref: keyRefs.current[index], __glissando: glissando && pressed, __position: notePosition(note), __note: note, __disabled: note > midiMax, __index: index, __fill: fill, __width: whiteNoteWidth * 0.65, __playNote: playNote, __stopNote: stopNote, __label: label }, blackKeyProps), note));
1034
+ }) })));
538
1035
  }
539
1036
 
1037
+ const minContext = React.createContext(0);
1038
+ const maxContext = React.createContext(0);
1039
+ const stepContext = React.createContext(0);
1040
+ const skewContext = React.createContext(0);
1041
+ const verticalContext = React.createContext(false);
1042
+ const reverseContext = React.createContext(false);
1043
+ const disabledContext = React.createContext(false);
1044
+ function SliderValuesProvider({ min: _min, max: _max, step: _step, skew: _skew, vertical: _vertical, reverse: _reverse, disabled: _disabled, children, }) {
1045
+ const [min] = React.useState(_min);
1046
+ const [max] = React.useState(_max);
1047
+ const [step] = React.useState(_step);
1048
+ const [skew] = React.useState(_skew);
1049
+ const [vertical] = React.useState(_vertical);
1050
+ const [reverse] = React.useState(_reverse);
1051
+ const [disabled] = React.useState(_disabled);
1052
+ return (jsxRuntime.jsx(minContext.Provider, { value: min, children: jsxRuntime.jsx(maxContext.Provider, { value: max, children: jsxRuntime.jsx(stepContext.Provider, { value: step, children: jsxRuntime.jsx(skewContext.Provider, { value: skew, children: jsxRuntime.jsx(verticalContext.Provider, { value: vertical, children: jsxRuntime.jsx(reverseContext.Provider, { value: reverse, children: jsxRuntime.jsx(disabledContext.Provider, { value: disabled, children: children }) }) }) }) }) }) }));
1053
+ }
1054
+ const useMin = () => React.useContext(minContext);
1055
+ const useMax = () => React.useContext(maxContext);
1056
+ const useStep = () => React.useContext(stepContext);
1057
+ const useSkew = () => React.useContext(skewContext);
1058
+ const useVertical = () => React.useContext(verticalContext);
1059
+ // export const useSetVertical = () => useContext(setVerticalContext)
1060
+ const useReverse = () => React.useContext(reverseContext);
1061
+ const useDisabled = () => React.useContext(disabledContext);
1062
+
540
1063
  /**
541
1064
  * clamp value between min and max
542
1065
  * @category Math
@@ -558,105 +1081,119 @@ function decimalPart(x) {
558
1081
 
559
1082
  /**
560
1083
  * @module Slider
561
- */
562
- function isHorizontal(d) {
563
- return d == 'right' || d == 'left';
564
- }
565
- function isVertical(d) {
566
- return d == 'up' || d == 'down';
567
- }
568
- function isReversed(d) {
569
- return d == 'left' || d == 'up';
570
- }
571
- function gradientDirection(d) {
572
- if (d == 'left' || d == 'right')
573
- return d;
574
- if (d == 'up')
575
- return 'top';
576
- if (d == 'down')
577
- return 'bottom';
578
- }
579
- function parseScaleOrderList(scale, min, max, step) {
1084
+ */
1085
+ function generateOptionsList(options, min, max, step) {
580
1086
  var _a;
581
- let scalesList = [];
582
- if (!scale) ;
583
- else if (typeof scale[0] == 'object') {
584
- scalesList = scale;
1087
+ const optionsList = [];
1088
+ const per = options[0] == 'step' ? step : options[0];
1089
+ const count = Math.floor(max / per) - Math.ceil(min / per) + 1;
1090
+ for (let i = 0; i < count; i++) {
1091
+ const value = toFixed(per * (Math.ceil(min / per) + i), (_a = decimalPart(per)) === null || _a === void 0 ? void 0 : _a.length);
1092
+ optionsList.push({ value: value, type: options[1] });
585
1093
  }
586
- else {
587
- const per = scale[0] == 'step' ? step : scale[0];
588
- const count = Math.floor(max / per) - Math.ceil(min / per) + 1;
589
- for (let i = 0; i < count; i++) {
590
- const at = toFixed(per * (Math.ceil(min / per) + i), (_a = decimalPart(per)) === null || _a === undefined ? undefined : _a.length);
591
- scalesList.push({ at: at, type: scale[1] });
592
- }
593
- }
594
- return scalesList;
1094
+ return optionsList;
1095
+ }
1096
+
1097
+ function ScaleOption(_a) {
1098
+ var { value, type = 'mark-number', label, thickness = 1, length = '0.5rem', gap = 2, labelWidth, classes, styles, className, style } = _a, props = __rest(_a, ["value", "type", "label", "thickness", "length", "gap", "labelWidth", "classes", "styles", "className", "style"]);
1099
+ const min = useMin();
1100
+ const max = useMax();
1101
+ const skew = useSkew();
1102
+ const vertical = useVertical();
1103
+ const reverse = useReverse();
1104
+ const calcPercent = React.useCallback((rawValue) => {
1105
+ return toFixed$2(xor(vertical, reverse)
1106
+ ? 100 - normalizeValue(rawValue, min, max, skew) * 100
1107
+ : normalizeValue(rawValue, min, max, skew) * 100);
1108
+ }, [vertical, reverse, max, min, skew]);
1109
+ return (jsxRuntime.jsxs("div", Object.assign({ className: clsx('tremolo-slider-scale-option', className), style: Object.assign({ left: !vertical ? `${calcPercent(value)}%` : undefined, top: vertical ? `${calcPercent(value)}%` : undefined }, style), "data-vertical": vertical }, props, { children: [type != 'number' && (jsxRuntime.jsx("div", { className: clsx('tremolo-slider-scale-option-mark', classes === null || classes === void 0 ? void 0 : classes.mark), style: Object.assign({ width: !vertical ? thickness : length, height: vertical ? thickness : length, marginBottom: !vertical ? gap : undefined, marginRight: vertical ? gap : undefined }, styles === null || styles === void 0 ? void 0 : styles.mark), "data-vertical": vertical })), type != 'mark' && (jsxRuntime.jsx("div", { className: clsx('tremolo-slider-scale-option-label', classes === null || classes === void 0 ? void 0 : classes.label), style: Object.assign({ width: labelWidth }, styles === null || styles === void 0 ? void 0 : styles.label), children: label || value }))] })));
1110
+ }
1111
+
1112
+ function Scale(_a) {
1113
+ var { gap = 6, options, children, className, style } = _a, props = __rest(_a, ["gap", "options", "children", "className", "style"]);
1114
+ const min = useMin();
1115
+ const max = useMax();
1116
+ const step = useStep();
1117
+ const vertical = useVertical();
1118
+ const reverse = useReverse();
1119
+ const optionsList = options
1120
+ ? generateOptionsList(options, min, max, step)
1121
+ : [];
1122
+ if (xor(vertical, reverse))
1123
+ optionsList.reverse();
1124
+ return (jsxRuntime.jsx("div", Object.assign({ className: clsx('tremolo-slider-scale', className), style: Object.assign({ marginLeft: vertical ? gap : undefined, marginTop: !vertical ? gap : undefined }, style) }, props, { children: options
1125
+ ? optionsList.map(({ value, type }, index) => {
1126
+ return jsxRuntime.jsx(ScaleOption, { value: value, type: type }, index);
1127
+ })
1128
+ : children })));
595
1129
  }
596
1130
 
597
- const SliderThumb = React.forwardRef(({ size, width = 22, height = 22, color = '#4e76e6', hoverColor = color, disabledColor = '#5d6478', disabledHoverColor = disabledColor, zIndex = 100, children, className, style, __disabled, __css, }, ref) => {
1131
+ const defaultThumbSize = 22;
1132
+ const SliderThumb = React.forwardRef(({ size, width = defaultThumbSize, height = defaultThumbSize, children, className, style, __percent, }, ref) => {
598
1133
  const wrapperRef = React.useRef(null);
1134
+ const vertical = useVertical();
1135
+ const disabled = useDisabled();
599
1136
  React.useImperativeHandle(ref, () => {
600
1137
  return {
601
1138
  focus() {
602
1139
  var _a;
603
- (_a = wrapperRef.current) === null || _a === undefined ? undefined : _a.focus();
1140
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.focus();
604
1141
  },
605
1142
  blur() {
606
1143
  var _a;
607
- (_a = wrapperRef.current) === null || _a === undefined ? undefined : _a.blur();
1144
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.blur();
608
1145
  },
609
1146
  };
610
1147
  }, []);
611
- return (jsxRuntime.jsx("div", { className: "tremolo-slider-thumb-wrapper", css: react.css(Object.assign({ position: 'absolute', translate: '-50% -50%', zIndex: zIndex }, __css)), children: children ? (children) : (
1148
+ return (jsxRuntime.jsx("div", { className: "tremolo-slider-thumb-wrapper", style: {
1149
+ top: vertical ? `${__percent}%` : '50%',
1150
+ left: !vertical ? `${__percent}%` : '50%',
1151
+ }, children: children ? (children) : (
612
1152
  // default slider thumb
613
1153
  jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx('tremolo-slider-thumb', className),
614
1154
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
615
- tabIndex: 0, css: react.css(Object.assign({ background: __disabled ? disabledColor : color, width: size !== null && size !== undefined ? size : width, height: size !== null && size !== undefined ? size : height, borderRadius: '50%', outline: 'none', '&:hover': {
616
- background: __disabled ? disabledHoverColor : hoverColor
617
- }, '&:focus': !__disabled && {
618
- boxShadow: '0px 0px 0px 3px rgba(var(--tremolo-theme-color-rgb), 0.2)',
619
- } }, style)) })) }));
1155
+ tabIndex: 0, "aria-disabled": disabled, style: Object.assign({ width: size !== null && size !== void 0 ? size : width, height: size !== null && size !== void 0 ? size : height }, style) })) }));
620
1156
  });
621
1157
 
622
- function SliderTrack({ length = 140, thickness = 10, activeBg = '#7998ec', inactiveBg = '#eee', activeHoverBg = '#6387e9', inactiveHoverBg = '#e0e0e0', disabledActiveBg = '#858890', disabledInactiveBg = '#ddd', disabledActiveHoverBg = disabledActiveBg, disabledInactiveHoverBg = disabledInactiveBg, children, className, style, __thumb, __direction, __disabled, __percent, }) {
623
- const active = __disabled ? disabledActiveBg : activeBg;
624
- const inactive = __disabled ? disabledInactiveBg : inactiveBg;
625
- const activeHover = __disabled ? disabledActiveHoverBg : activeHoverBg;
626
- const inactiveHover = __disabled ? disabledInactiveHoverBg : inactiveHoverBg;
627
- return (jsxRuntime.jsxs("div", { className: clsx('tremolo-slider-track', className), css: react.css(Object.assign({ position: 'relative', background: `linear-gradient(to ${gradientDirection(__direction)}, ${active} ${__percent}%, ${inactive} ${__percent}%)`, borderRadius: styleHelper(thickness, '/', 2), width: isHorizontal(__direction) ? length : thickness, height: isHorizontal(__direction) ? thickness : length, ':hover': {
628
- background: `linear-gradient(to ${gradientDirection(__direction)}, ${activeHover} ${__percent}%, ${inactiveHover} ${__percent}%)`
629
- } }, style)), children: [children, __thumb] }));
1158
+ const defaultLength = 140;
1159
+ const defaultThickness = 10;
1160
+ function SliderTrack({ length = defaultLength, thickness = defaultThickness, active, inactive, children, className, style, __thumb, __percent, }) {
1161
+ const vertical = useVertical();
1162
+ const reverse = useReverse();
1163
+ const disabled = useDisabled();
1164
+ const direction = vertical ? 'bottom' : 'right';
1165
+ const colors = {
1166
+ '--active': active,
1167
+ '--inactive': inactive,
1168
+ };
1169
+ return (jsxRuntime.jsxs("div", { className: clsx('tremolo-slider-track', className), "aria-disabled": disabled, style: Object.assign(Object.assign(Object.assign({}, colors), { background: xor(vertical, reverse)
1170
+ ? `linear-gradient(to ${direction}, var(--inactive, #eee) ${__percent}%, var(--active, #7998ec) ${__percent}%)`
1171
+ : `linear-gradient(to ${direction}, var(--active, #7998ec) ${__percent}%, var(--inactive, #eee) ${__percent}%)`, borderRadius: styleHelper(thickness, '/', 2), width: !vertical ? length : thickness, height: vertical ? length : thickness }), style), children: [children, __thumb] }));
630
1172
  }
631
1173
 
632
1174
  /**
633
1175
  * Customizable slider
634
1176
  */
635
1177
  const Slider = React.forwardRef((_a, ref) => {
636
- var _b, _c, _d, _e, _f, _g, _h;
637
- var { value, min, max, step = 1, skew = 1, direction = 'right', scale, scaleOption, className, style, bodyNoSelect = true, wheel = ['raw', 1], keyboard = ['raw', 1], disabled = false, readonly = false, onChange, children } = _a; __rest(_a, ["value", "min", "max", "step", "skew", "direction", "scale", "scaleOption", "className", "style", "bodyNoSelect", "wheel", "keyboard", "disabled", "readonly", "onChange", "children"]);
1178
+ var _b, _c, _d;
1179
+ var { value, min, max, step = 1, skew = 1, vertical = false, reverse = false, className, style, bodyNoSelect = true, wheel = ['raw', 1], keyboard = ['raw', 1], disabled = false, readonly = false, onChange, children } = _a, props = __rest(_a, ["value", "min", "max", "step", "skew", "vertical", "reverse", "className", "style", "bodyNoSelect", "wheel", "keyboard", "disabled", "readonly", "onChange", "children"]);
638
1180
  // -- state and ref ---
639
1181
  const trackElementRef = React.useRef(null);
640
1182
  const thumbRef = React.useRef(null);
641
1183
  const thumbDragged = React.useRef(false);
642
- const percent = toFixed$2(normalizeValue(value, min, max, skew) * 100);
643
- const percentRev = isReversed(direction) ? toFixed$2(100 - percent) : percent;
644
- const calcPercent = (v) => {
645
- return toFixed$2(isReversed(direction)
646
- ? 100 - normalizeValue(v, min, max, skew) * 100
647
- : normalizeValue(v, min, max, skew) * 100);
648
- };
649
- if (wheel.length != 2) {
650
- throw new Error(`Slider.wheel expect ['normalized' | 'raw', number]`);
651
- }
652
- if (keyboard.length != 2) {
653
- throw new Error(`Slider.keyboard expect ['normalized' | 'raw', number]`);
654
- }
655
- const scalesList = parseScaleOrderList(scale, min, max, step);
656
- if (isReversed(direction))
657
- scalesList.reverse();
658
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
659
- let trackProps, thumbProps;
1184
+ // --- interpret props ---
1185
+ const p = toFixed$2(normalizeValue(value, min, max, skew) * 100);
1186
+ const rev = toFixed$2(100 - p);
1187
+ // NOTE
1188
+ // normal -> normal (right)
1189
+ // vertical -> rev (up)
1190
+ // reverse -> rev (left)
1191
+ // vertical & reverse -> normal (down)
1192
+ const displayReversed = React.useMemo(() => xor(vertical, reverse), [vertical, reverse]);
1193
+ const percent = displayReversed ? rev : p;
1194
+ let trackProps = {};
1195
+ let thumbProps = {};
1196
+ let scaleComponent = undefined;
660
1197
  if (children != undefined) {
661
1198
  React.Children.forEach(children, (child) => {
662
1199
  if (React.isValidElement(child)) {
@@ -666,6 +1203,9 @@ const Slider = React.forwardRef((_a, ref) => {
666
1203
  else if (child.type == SliderTrack) {
667
1204
  trackProps = child.props;
668
1205
  }
1206
+ else if (child.type == Scale) {
1207
+ scaleComponent = child;
1208
+ }
669
1209
  else {
670
1210
  throw new Error('only <SliderThumb> or <SliderTrack>');
671
1211
  }
@@ -677,8 +1217,12 @@ const Slider = React.forwardRef((_a, ref) => {
677
1217
  }
678
1218
  // --- internal functions ---
679
1219
  const handleValue = (event) => {
680
- if (!trackElementRef.current || !thumbDragged.current || !onChange || readonly)
1220
+ if (!trackElementRef.current ||
1221
+ !thumbDragged.current ||
1222
+ !onChange ||
1223
+ readonly) {
681
1224
  return;
1225
+ }
682
1226
  const isTouch = event instanceof TouchEvent;
683
1227
  if (isTouch && event.cancelable)
684
1228
  event.preventDefault();
@@ -687,10 +1231,10 @@ const Slider = React.forwardRef((_a, ref) => {
687
1231
  const { left: x1, top: y1, right: x2, bottom: y2, } = trackElementRef.current.getBoundingClientRect();
688
1232
  const mouseX = isTouch ? event.touches[0].clientX : event.clientX;
689
1233
  const mouseY = isTouch ? event.touches[0].clientY : event.clientY;
690
- const n = isHorizontal(direction)
691
- ? normalizeValue(mouseX, x1, x2)
692
- : normalizeValue(mouseY, y1, y2);
693
- const v = rawValue(isReversed(direction) ? 1 - n : n, min, max, skew);
1234
+ const n = vertical
1235
+ ? normalizeValue(mouseY, y1, y2)
1236
+ : normalizeValue(mouseX, x1, x2);
1237
+ const v = rawValue(displayReversed ? 1 - n : n, min, max, skew);
694
1238
  onChange(clamp(stepValue(v, step), min, max));
695
1239
  };
696
1240
  const handleKeyDown = React.useCallback((event) => {
@@ -699,8 +1243,8 @@ const Slider = React.forwardRef((_a, ref) => {
699
1243
  const key = event.key;
700
1244
  if (['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'].includes(key)) {
701
1245
  event.preventDefault();
702
- let x = (key == 'ArrowRight' || key == 'ArrowUp') ? keyboard[1] : -keyboard[1];
703
- if (direction == 'down' || direction == 'left')
1246
+ let x = key == 'ArrowRight' || key == 'ArrowUp' ? keyboard[1] : -keyboard[1];
1247
+ if (reverse)
704
1248
  x *= -1;
705
1249
  let v;
706
1250
  if (keyboard[0] == 'normalized') {
@@ -712,15 +1256,23 @@ const Slider = React.forwardRef((_a, ref) => {
712
1256
  }
713
1257
  onChange(clamp(stepValue(v, step), min, max));
714
1258
  }
715
- }, [value, min, max, step, skew, direction, keyboard, onChange, readonly]);
1259
+ }, [value, min, max, step, skew, reverse, keyboard, onChange, readonly]);
716
1260
  // --- hooks ---
717
- const touchMoveRefCallback = useRefCallbackEvent('touchmove', handleValue, { passive: false }, [min, max, skew, step, direction, onChange, readonly]);
1261
+ const touchMoveRefCallback = useRefCallbackEvent('touchmove', handleValue, { passive: false }, [min, max, skew, step, vertical, reverse, onChange, readonly]);
718
1262
  const wheelRefCallback = useRefCallbackEvent('wheel', (event) => {
719
1263
  if (!wheel || !onChange || readonly)
720
1264
  return;
721
1265
  event.preventDefault();
722
- let x = event.deltaY > 0 ? wheel[1] : -wheel[1];
723
- if (isReversed(direction) || isHorizontal(direction))
1266
+ let x;
1267
+ if (!vertical && event.deltaX != 0) {
1268
+ x = event.deltaX > 0 ? wheel[1] : -wheel[1];
1269
+ }
1270
+ else {
1271
+ if (event.deltaY == 0)
1272
+ return;
1273
+ x = event.deltaY > 0 ? -wheel[1] : wheel[1];
1274
+ }
1275
+ if (vertical && reverse)
724
1276
  x *= -1;
725
1277
  let v;
726
1278
  if (wheel[0] == 'normalized') {
@@ -746,71 +1298,256 @@ const Slider = React.forwardRef((_a, ref) => {
746
1298
  return {
747
1299
  focus() {
748
1300
  var _a;
749
- (_a = thumbRef.current) === null || _a === undefined ? undefined : _a.focus();
1301
+ (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1302
+ },
1303
+ blur() {
1304
+ var _a;
1305
+ (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.blur();
1306
+ },
1307
+ };
1308
+ }, []);
1309
+ return (jsxRuntime.jsx(SliderValuesProvider, { min: min, max: max, step: step, skew: skew, vertical: vertical, reverse: reverse, disabled: disabled, children: jsxRuntime.jsx("div", Object.assign({ className: clsx('tremolo-slider', className), ref: (div) => {
1310
+ wheelRefCallback(div);
1311
+ touchMoveRefCallback(div);
1312
+ }, tabIndex: -1, role: "slider", "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": vertical ? 'vertical' : 'horizontal', "aria-disabled": disabled, "aria-readonly": readonly, style: Object.assign({ margin: `calc(${styleHelper((_b = thumbProps === null || thumbProps === void 0 ? void 0 : thumbProps.size) !== null && _b !== void 0 ? _b : 22)} / 2)` }, style), onPointerDown: (event) => {
1313
+ thumbDragged.current = true;
1314
+ handleValue(event);
1315
+ }, onKeyDown: handleKeyDown, onFocus: (_c = thumbRef.current) === null || _c === void 0 ? void 0 : _c.focus, onBlur: (_d = thumbRef.current) === null || _d === void 0 ? void 0 : _d.blur }, props, { children: jsxRuntime.jsxs("div", { style: {
1316
+ display: 'flex',
1317
+ flexDirection: vertical ? 'row' : 'column',
1318
+ }, children: [jsxRuntime.jsx("div", { className: "tremolo-slider-track-wrapper", ref: trackElementRef, children: jsxRuntime.jsx(SliderTrack, Object.assign({ __percent: percent, __thumb: jsxRuntime.jsx(SliderThumb, Object.assign({ ref: thumbRef, __percent: percent }, thumbProps)) }, trackProps)) }), scaleComponent] }) })) }));
1319
+ });
1320
+
1321
+ function WheelObserver(props) {
1322
+ const { children, onWheel, as: Component = 'div' } = props, attributes = __rest(props, ["children", "onWheel", "as"]);
1323
+ const wheelRefCallback = useRefCallbackEvent('wheel', (event) => {
1324
+ if (onWheel)
1325
+ onWheel(event);
1326
+ }, { passive: false }, [onWheel]);
1327
+ return (jsxRuntime.jsx(Component, Object.assign({ ref: wheelRefCallback }, attributes, { children: children })));
1328
+ }
1329
+
1330
+ function XYPadArea({ width = 120, height = 120, bg = '#eee', children, className, style, __thumb, }) {
1331
+ return (jsxRuntime.jsxs("div", { className: clsx('tremolo-xy-pad-area', className), style: Object.assign({ position: 'relative', width: width, height: height, background: bg }, style), children: [children, __thumb] }));
1332
+ }
1333
+
1334
+ const XYPadThumb = React.forwardRef(({ size, width = 22, height = 22, children, wrapperClassName, wrapperStyle, className, style, __disabled, __css, }, ref) => {
1335
+ const wrapperRef = React.useRef(null);
1336
+ React.useImperativeHandle(ref, () => {
1337
+ return {
1338
+ focus() {
1339
+ var _a;
1340
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.focus();
1341
+ },
1342
+ blur() {
1343
+ var _a;
1344
+ (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.blur();
1345
+ },
1346
+ };
1347
+ }, []);
1348
+ return (jsxRuntime.jsx("div", { className: clsx('tremolo-xy-pad-thumb-wrapper', wrapperClassName), style: Object.assign(Object.assign({}, __css), wrapperStyle), children: children ? (children) : (
1349
+ // default thumb
1350
+ jsxRuntime.jsx("div", { ref: wrapperRef, className: clsx('tremolo-xy-pad-thumb', className),
1351
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
1352
+ tabIndex: 0, "aria-disabled": __disabled, style: Object.assign({ width: size !== null && size !== void 0 ? size : width, height: size !== null && size !== void 0 ? size : height }, style) })) }));
1353
+ });
1354
+
1355
+ const defaultValueOptions = {
1356
+ skew: 1,
1357
+ step: 1,
1358
+ reverse: false,
1359
+ wheel: ['raw', 1],
1360
+ keyboard: ['raw', 1],
1361
+ };
1362
+ /**
1363
+ * Simple XYPad
1364
+ */
1365
+ const XYPad = React.forwardRef((_a, ref) => {
1366
+ var _b, _c, _d;
1367
+ var { x: _x, y: _y, className, style, bodyNoSelect = true, disabled = false, readonly = false, onChange, children } = _a, props = __rest(_a, ["x", "y", "className", "style", "bodyNoSelect", "disabled", "readonly", "onChange", "children"]);
1368
+ const x = React.useMemo(() => {
1369
+ return Object.assign(Object.assign({}, defaultValueOptions), _x);
1370
+ }, [_x]);
1371
+ const y = React.useMemo(() => {
1372
+ return Object.assign(Object.assign({}, defaultValueOptions), _y);
1373
+ }, [_y]);
1374
+ // -- state and ref ---
1375
+ const areaElementRef = React.useRef(null);
1376
+ const thumbRef = React.useRef(null);
1377
+ const thumbDragged = React.useRef(false);
1378
+ // --- interpret props ---
1379
+ const nx = normalizeValue(x.value, x.min, x.max, x.skew);
1380
+ const ny = normalizeValue(y.value, y.min, y.max, y.skew);
1381
+ const percentX = toFixed$2((x.reverse ? 1 - nx : nx) * 100);
1382
+ const percentY = toFixed$2((y.reverse ? 1 - ny : ny) * 100);
1383
+ let areaProps = {}, thumbProps = {};
1384
+ if (children != undefined) {
1385
+ React.Children.forEach(children, (child) => {
1386
+ if (React.isValidElement(child)) {
1387
+ if (child.type == XYPadThumb) {
1388
+ thumbProps = child.props;
1389
+ }
1390
+ else if (child.type == XYPadArea) {
1391
+ areaProps = child.props;
1392
+ }
1393
+ else {
1394
+ throw new Error('only <XYPadThumb> or <XYPadArea>');
1395
+ }
1396
+ }
1397
+ else {
1398
+ throw new Error('children is an invalid element.');
1399
+ }
1400
+ });
1401
+ }
1402
+ // --- internal functions ---
1403
+ const handleValue = (event) => {
1404
+ if (!areaElementRef.current ||
1405
+ !thumbDragged.current ||
1406
+ !onChange ||
1407
+ readonly)
1408
+ return;
1409
+ const isTouch = event instanceof TouchEvent;
1410
+ if (isTouch && event.cancelable)
1411
+ event.preventDefault();
1412
+ if (bodyNoSelect)
1413
+ addNoSelect();
1414
+ const { left: x1, top: y1, right: x2, bottom: y2, } = areaElementRef.current.getBoundingClientRect();
1415
+ const mouseX = isTouch ? event.touches[0].clientX : event.clientX;
1416
+ const mouseY = isTouch ? event.touches[0].clientY : event.clientY;
1417
+ const nx = normalizeValue(mouseX, x1, x2);
1418
+ const ny = normalizeValue(mouseY, y1, y2);
1419
+ const vx = rawValue(x.reverse ? 1 - nx : nx, x.min, x.max, x.skew);
1420
+ const vy = rawValue(y.reverse ? 1 - ny : ny, y.min, y.max, y.skew);
1421
+ const newX = clamp(stepValue(vx, x.step), x.min, x.max);
1422
+ const newY = clamp(stepValue(vy, y.step), y.min, y.max);
1423
+ onChange(newX, newY);
1424
+ };
1425
+ const handleKeyDown = React.useCallback((event) => {
1426
+ if (!onChange || readonly)
1427
+ return;
1428
+ const key = event.key;
1429
+ if (['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown'].includes(key)) {
1430
+ const isHorizontal = key == 'ArrowRight' || key == 'ArrowLeft';
1431
+ const target = isHorizontal ? x : y;
1432
+ if (!target.keyboard)
1433
+ return;
1434
+ event.preventDefault();
1435
+ let delta = target.keyboard[1];
1436
+ if (key == 'ArrowLeft' || key == 'ArrowUp')
1437
+ delta *= -1;
1438
+ if (target.reverse)
1439
+ delta *= -1;
1440
+ let v;
1441
+ if (target.keyboard[0] == 'normalized') {
1442
+ const n = normalizeValue(target.value, target.min, target.max, target.skew);
1443
+ v = rawValue(n + delta, target.min, target.max, target.skew);
1444
+ }
1445
+ else {
1446
+ v = target.value + delta;
1447
+ }
1448
+ const newValue = clamp(stepValue(v, target.step), target.min, target.max);
1449
+ if (isHorizontal) {
1450
+ onChange(newValue, y.value);
1451
+ }
1452
+ else {
1453
+ onChange(x.value, newValue);
1454
+ }
1455
+ }
1456
+ }, [x, y, onChange, readonly]);
1457
+ // --- hooks ---
1458
+ const touchMoveRefCallback = useRefCallbackEvent('touchmove', handleValue, { passive: false }, [x, onChange, readonly]);
1459
+ const wheelRefCallback = useRefCallbackEvent('wheel', (event) => {
1460
+ if (!onChange || readonly)
1461
+ return;
1462
+ const target = event.shiftKey ? x : y;
1463
+ if (!target.wheel)
1464
+ return;
1465
+ event.preventDefault();
1466
+ let delta = target.wheel[1];
1467
+ if (event.deltaY < 0)
1468
+ delta *= -1;
1469
+ if (target.reverse)
1470
+ delta *= -1;
1471
+ let v;
1472
+ if (target.wheel[0] == 'normalized') {
1473
+ const n = normalizeValue(target.value, target.min, target.max, target.skew);
1474
+ v = rawValue(n + delta, target.min, target.max, target.skew);
1475
+ }
1476
+ else {
1477
+ v = target.value + delta;
1478
+ }
1479
+ const newValue = clamp(stepValue(v, target.step), target.min, target.max);
1480
+ if (event.shiftKey) {
1481
+ onChange(newValue, y.value);
1482
+ }
1483
+ else {
1484
+ onChange(x.value, newValue);
1485
+ }
1486
+ }, {
1487
+ passive: false,
1488
+ }, [x, y]);
1489
+ useEventListener(window, 'mousemove', (event) => {
1490
+ handleValue(event);
1491
+ });
1492
+ useEventListener(window, 'mouseup', () => {
1493
+ thumbDragged.current = false;
1494
+ if (bodyNoSelect)
1495
+ removeNoSelect();
1496
+ });
1497
+ React.useImperativeHandle(ref, () => {
1498
+ return {
1499
+ focus() {
1500
+ var _a;
1501
+ (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.focus();
750
1502
  },
751
1503
  blur() {
752
1504
  var _a;
753
- (_a = thumbRef.current) === null || _a === undefined ? undefined : _a.blur();
1505
+ (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.blur();
754
1506
  },
755
1507
  };
756
1508
  }, []);
757
- return (jsxRuntime.jsxs("div", { className: clsx('tremolo-slider', className), ref: (div) => {
1509
+ return (
1510
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
1511
+ jsxRuntime.jsx("div", Object.assign({ className: clsx('tremolo-xy-pad', className), ref: (div) => {
758
1512
  wheelRefCallback(div);
759
1513
  touchMoveRefCallback(div);
760
- }, tabIndex: -1, role: "slider", "aria-valuenow": value, "aria-valuemin": min, "aria-valuemax": max, "aria-orientation": isHorizontal(direction) ? 'horizontal' : 'vertical', "aria-disabled": disabled, "aria-readonly": readonly, css: react.css(Object.assign({ display: 'inline-block', margin: `calc(${styleHelper((_b = thumbProps === null || thumbProps === undefined ? undefined : thumbProps.size) !== null && _b !== undefined ? _b : 22)} / 2)`, cursor: readonly ? 'not-allowed' : 'pointer', outline: 0 }, style)), onPointerDown: (event) => {
1514
+ }, tabIndex: -1, "aria-disabled": disabled, "aria-readonly": readonly, style: Object.assign({ margin: `calc(${styleHelper((_b = thumbProps === null || thumbProps === void 0 ? void 0 : thumbProps.size) !== null && _b !== void 0 ? _b : 22)} / 2)`, cursor: readonly ? 'not-allowed' : 'pointer', WebkitTapHighlightColor: 'transparent' }, style), onPointerDown: (event) => {
761
1515
  thumbDragged.current = true;
762
1516
  handleValue(event);
763
- }, onKeyDown: handleKeyDown, onFocus: (_c = thumbRef.current) === null || _c === undefined ? undefined : _c.focus, onBlur: (_d = thumbRef.current) === null || _d === undefined ? undefined : _d.blur, children: [jsxRuntime.jsx(react.Global, { styles: {
764
- '.no-select': {
765
- userSelect: 'none',
766
- },
767
- } }), jsxRuntime.jsxs("div", { css: react.css({
768
- display: 'flex',
769
- flexDirection: isHorizontal(direction) ? 'column' : 'row',
770
- }), children: [jsxRuntime.jsx("div", { className: "tremolo-slider-track-wrapper", ref: trackElementRef, children: jsxRuntime.jsx(SliderTrack, Object.assign({ __direction: direction, __disabled: disabled, __percent: percent, __thumb: jsxRuntime.jsx(SliderThumb, Object.assign({ ref: thumbRef, __disabled: disabled, __css: {
771
- top: isHorizontal(direction) ? '50%' : `${percentRev}%`,
772
- left: isHorizontal(direction) ? `${percentRev}%` : '50%',
773
- } }, thumbProps)) }, trackProps)) }), scale && (jsxRuntime.jsx("div", { className: "tremolo-slider-scale-wrapper", css: react.css(Object.assign({ display: 'block', position: 'relative', marginLeft: isVertical(direction)
774
- ? ((_e = scaleOption === null || scaleOption === undefined ? undefined : scaleOption.gap) !== null && _e !== undefined ? _e : `calc((22px - ${styleHelper((_f = trackProps === null || trackProps === undefined ? undefined : trackProps.thickness) !== null && _f !== undefined ? _f : 10)}) / 2)`)
775
- : undefined, marginTop: isHorizontal(direction)
776
- ? ((_g = scaleOption === null || scaleOption === undefined ? undefined : scaleOption.gap) !== null && _g !== undefined ? _g : `calc((22px - ${styleHelper((_h = trackProps === null || trackProps === undefined ? undefined : trackProps.thickness) !== null && _h !== undefined ? _h : 10)}) / 2)`)
777
- : undefined }, scaleOption === null || scaleOption === undefined ? undefined : scaleOption.style)), children: scalesList.map((item, index) => {
778
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
779
- return (jsxRuntime.jsxs("div", { css: react.css({
780
- display: 'flex',
781
- flexDirection: isHorizontal(direction) ? 'column' : 'row',
782
- justifyContent: 'center',
783
- alignItems: 'center',
784
- position: 'absolute',
785
- left: isHorizontal(direction) ? `${calcPercent(item.at)}%` : undefined,
786
- top: isVertical(direction) ? `${calcPercent(item.at)}%` : undefined,
787
- translate: isHorizontal(direction) ? '-50% 0' : '0 -50%',
788
- zIndex: 10,
789
- }), children: [((_b = (_a = item.type) !== null && _a !== undefined ? _a : scaleOption === null || scaleOption === undefined ? undefined : scaleOption.defaultType) !== null && _b !== undefined ? _b : 'mark-number') !=
790
- 'number' && (jsxRuntime.jsx("div", { className: "tremolo-slider-scale-mark", css: react.css({
791
- width: isHorizontal(direction)
792
- ? ((_d = (_c = item.style) === null || _c === undefined ? undefined : _c.thickness) !== null && _d !== undefined ? _d : 1)
793
- : ((_f = (_e = item.style) === null || _e === undefined ? undefined : _e.length) !== null && _f !== undefined ? _f : '0.5rem'),
794
- height: isVertical(direction)
795
- ? ((_h = (_g = item.style) === null || _g === undefined ? undefined : _g.thickness) !== null && _h !== undefined ? _h : 1)
796
- : ((_k = (_j = item.style) === null || _j === undefined ? undefined : _j.length) !== null && _k !== undefined ? _k : '0.5rem'),
797
- backgroundColor: (_o = (_m = (_l = item.style) === null || _l === undefined ? undefined : _l.markColor) !== null && _m !== undefined ? _m : scaleOption === null || scaleOption === undefined ? undefined : scaleOption.markColor) !== null && _o !== undefined ? _o : '#222',
798
- marginBottom: isHorizontal(direction) ? 2 : undefined,
799
- marginRight: isVertical(direction) ? 2 : undefined,
800
- }) })), ((_q = (_p = item.type) !== null && _p !== undefined ? _p : scaleOption === null || scaleOption === undefined ? undefined : scaleOption.defaultType) !== null && _q !== undefined ? _q : 'mark-number') !=
801
- 'mark' && (jsxRuntime.jsx("div", { className: "tremolo-slider-scale-number", css: react.css({
802
- color: (_s = (_r = item.style) === null || _r === undefined ? undefined : _r.labelColor) !== null && _s !== undefined ? _s : scaleOption === null || scaleOption === undefined ? undefined : scaleOption.labelColor,
803
- width: scaleOption === null || scaleOption === undefined ? undefined : scaleOption.labelWidth,
804
- textAlign: 'right',
805
- }), children: (_t = item.text) !== null && _t !== undefined ? _t : item.at }))] }, index));
806
- }) }))] })] }));
1517
+ }, onKeyDown: handleKeyDown, onFocus: (_c = thumbRef.current) === null || _c === void 0 ? void 0 : _c.focus, onBlur: (_d = thumbRef.current) === null || _d === void 0 ? void 0 : _d.blur }, props, { children: jsxRuntime.jsx("div", { className: "tremolo-xy-pad-area-wrapper", ref: areaElementRef, children: jsxRuntime.jsx(XYPadArea, Object.assign({ __thumb: jsxRuntime.jsx(XYPadThumb, Object.assign({ ref: thumbRef, __disabled: disabled, __css: {
1518
+ top: `${percentY}%`,
1519
+ left: `${percentX}%`,
1520
+ } }, thumbProps)) }, areaProps)) }) })));
807
1521
  });
808
1522
 
809
1523
  exports.AnimationCanvas = AnimationCanvas;
1524
+ exports.AnimationKnob = AnimationKnob;
1525
+ exports.BlackKey = BlackKey;
1526
+ exports.DragObserver = DragObserver;
1527
+ exports.KeyLabel = KeyLabel;
810
1528
  exports.Knob = Knob;
811
1529
  exports.NumberInput = NumberInput;
1530
+ exports.Piano = Piano;
1531
+ exports.Scale = Scale;
1532
+ exports.ScaleOption = ScaleOption;
1533
+ exports.Shortcuts = Shortcuts;
812
1534
  exports.Slider = Slider;
813
1535
  exports.SliderThumb = SliderThumb;
814
1536
  exports.SliderTrack = SliderTrack;
815
- exports.gradientDirection = gradientDirection;
1537
+ exports.SliderValuesProvider = SliderValuesProvider;
1538
+ exports.WheelObserver = WheelObserver;
1539
+ exports.WhiteKey = WhiteKey;
1540
+ exports.XYPad = XYPad;
1541
+ exports.XYPadArea = XYPadArea;
1542
+ exports.XYPadThumb = XYPadThumb;
1543
+ exports.defaultLength = defaultLength;
1544
+ exports.defaultThickness = defaultThickness;
1545
+ exports.defaultThumbSize = defaultThumbSize;
1546
+ exports.useDisabled = useDisabled;
1547
+ exports.useMax = useMax;
1548
+ exports.useMin = useMin;
1549
+ exports.useReverse = useReverse;
1550
+ exports.useSkew = useSkew;
1551
+ exports.useStep = useStep;
1552
+ exports.useVertical = useVertical;
816
1553
  //# sourceMappingURL=index.js.map