@tremolo-ui/react 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/index.cjs +416 -252
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +256 -110
  4. package/dist/index.d.cts.map +1 -1
  5. package/dist/index.d.ts +256 -110
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +368 -203
  8. package/dist/index.js.map +1 -1
  9. package/package.json +9 -9
  10. package/src/components/AnimationCanvas/index.tsx +4 -18
  11. package/src/components/FileInput/index.tsx +4 -1
  12. package/src/components/Knob/Thumb.tsx +19 -19
  13. package/src/components/Knob/index.tsx +85 -41
  14. package/src/components/NumberInput/InputField.tsx +9 -7
  15. package/src/components/NumberInput/Stepper.tsx +30 -6
  16. package/src/components/NumberInput/StepperButton.tsx +12 -4
  17. package/src/components/NumberInput/context.tsx +24 -2
  18. package/src/components/NumberInput/index.tsx +142 -27
  19. package/src/components/Piano/index.tsx +24 -7
  20. package/src/components/PointsEditor/Container.tsx +1 -1
  21. package/src/components/PointsEditor/Point.tsx +61 -30
  22. package/src/components/PointsEditor/context.tsx +3 -4
  23. package/src/components/PointsEditor/index.tsx +14 -15
  24. package/src/components/Slider/Marks.tsx +3 -2
  25. package/src/components/Slider/MarksOption.tsx +3 -2
  26. package/src/components/Slider/Thumb.tsx +20 -11
  27. package/src/components/Slider/Track.tsx +15 -13
  28. package/src/components/Slider/context.tsx +3 -3
  29. package/src/components/Slider/index.tsx +85 -48
  30. package/src/components/XYPad/Thumb.tsx +18 -8
  31. package/src/components/XYPad/context.tsx +1 -1
  32. package/src/components/XYPad/index.tsx +74 -42
  33. package/src/components/_util/VisuallyHiddenRangeInput.tsx +1 -1
  34. package/src/hooks/_internal/useChangeGesture.ts +93 -0
  35. package/src/hooks/_internal/useCheckSteps.ts +1 -1
  36. package/src/hooks/useAnimationFrame.ts +37 -15
  37. package/src/hooks/useEventListener.ts +93 -22
  38. package/src/hooks/useWheel.ts +4 -4
  39. package/src/index.ts +9 -5
  40. package/src/hooks/useInterval.ts +0 -27
package/dist/index.d.cts CHANGED
@@ -1,14 +1,7 @@
1
- import React, { AriaAttributes, CSSProperties, ComponentPropsWithoutRef, DependencyList, ReactNode, Ref, RefObject, SVGProps } from "react";
2
- import { AnimationFrame, AxisOptions, DragState, DropZoneOptions, InputEventOption, KeyboardShortcuts, KeyboardShortcutsScope, KnobAngles, MIDIAccessOptions, MIDIInputHandlers, MarksOptions, ModifierState, ModifierValue, NoteRange, PointPosition, PointsEditorInstance, SelectionBoxRect, WheelOptions, XY, XYInput } from "@tremolo-ui/dom";
1
+ import React, { AriaAttributes, CSSProperties, ComponentPropsWithoutRef, ReactNode, Ref, RefObject, SVGProps } from "react";
2
+ import { AxisOptions, CanvasDrawFunction, CanvasInitFunction, ChangeSource, DragState, DropZoneOptions, InputEventOption, KeyboardShortcuts, KeyboardShortcutsScope, KnobAngles, MIDIAccessOptions, MIDIInputHandlers, MarksOptions, ModifierState, ModifierValue, NoteRange, PointPosition, PointsEditorInstance, SelectionBoxRect, WheelOptions, XY, XYInput } from "@tremolo-ui/dom";
3
3
  import { Scale, ValueRange } from "@tremolo-ui/functions";
4
4
  //#region src/components/AnimationCanvas/index.d.ts
5
- type InitFunction = (context: CanvasRenderingContext2D, option: {
6
- /** current canvas width */
7
- width: number;
8
- /** current canvas height */
9
- height: number;
10
- }) => void;
11
- type DrawFunction = (context: CanvasRenderingContext2D, option: AnimationFrame) => void;
12
5
  interface AnimationCanvasCommonProps {
13
6
  /**
14
7
  * Draw one frame. It is given the 2D context and the frame: the size in CSS
@@ -17,12 +10,12 @@ interface AnimationCanvasCommonProps {
17
10
  * A new function replaces the old one in place, so writing it inline does
18
11
  * not restart anything.
19
12
  */
20
- draw: DrawFunction;
13
+ draw: CanvasDrawFunction;
21
14
  /**
22
15
  * Called once before the first frame, with the context and the size in CSS
23
16
  * pixels. Set up what every frame shares here.
24
17
  */
25
- init?: InitFunction;
18
+ init?: CanvasInitFunction;
26
19
  /**
27
20
  * Redraw on every animation frame. Turn it off to draw only when there is a
28
21
  * reason to: when the canvas mounts, when it is resized, and when the
@@ -219,37 +212,37 @@ interface KnobThumbProps {
219
212
  * Fill colour of the circle.
220
213
  * @default 'currentColor'
221
214
  */
222
- thumb?: string;
215
+ color?: string;
223
216
  /**
224
217
  * Colour of the line that points at the value.
225
218
  * @default 'currentColor'
226
219
  */
227
- thumbLine?: string;
220
+ lineColor?: string;
228
221
  /**
229
222
  * Diameter of the circle, as a percentage of the knob.
230
223
  * @default 84
231
224
  */
232
- thumbSize?: number;
225
+ size?: number;
233
226
  /**
234
227
  * Thickness of the line, as a percentage of the knob.
235
228
  * @default 6
236
229
  */
237
- thumbLineWeight?: number;
230
+ lineWeight?: number;
238
231
  /**
239
232
  * How far down the line reaches, as a percentage of the knob from its top.
240
233
  * The line starts at the edge of the circle.
241
234
  * @default 35
242
235
  */
243
- thumbLineLength?: number;
236
+ lineLength?: number;
244
237
  /**
245
- * Classes for what the thumb draws inside itself: `thumbLine` is the line
246
- * that points at the value.
238
+ * Classes for what the thumb draws inside itself: `line` is the line that
239
+ * points at the value.
247
240
  */
248
241
  classes?: {
249
- thumbLine?: string;
242
+ line?: string;
250
243
  };
251
244
  }
252
- declare function Thumb({ className, thumb, thumbLine, thumbSize, thumbLineWeight, thumbLineLength, classes, ...props }: KnobThumbProps & Omit<SVGProps<SVGSVGElement>, 'd' | keyof KnobThumbProps>): import("react").JSX.Element;
245
+ declare function Thumb({ className, color, lineColor, size, lineWeight, lineLength, classes, ...props }: KnobThumbProps & Omit<SVGProps<SVGSVGElement>, 'd' | keyof KnobThumbProps>): import("react").JSX.Element;
253
246
  //#endregion
254
247
  //#region src/css-variables.d.ts
255
248
  /**
@@ -317,10 +310,10 @@ interface KnobProps {
317
310
  */
318
311
  scale?: Scale;
319
312
  /**
320
- * The value a double click restores, while `enableDoubleClickDefault` is on.
321
- * @default min
313
+ * The value a double click restores. `null` turns the double click off.
314
+ * @default startValue
322
315
  */
323
- defaultValue?: number;
316
+ resetValue?: number | null;
324
317
  /**
325
318
  * Where the active arc starts. Put it at the centre of a bipolar control,
326
319
  * such as a pan knob, so that the arc grows from there either way.
@@ -336,11 +329,9 @@ interface KnobProps {
336
329
  * The cursor to show while dragging. It is set on the dragged element, so it
337
330
  * stays while the pointer is outside the knob.
338
331
  *
339
- * @default { cursor: 'grabbing' }
332
+ * @default 'grabbing'
340
333
  */
341
- externalStyles?: {
342
- cursor?: CSSProperties['cursor'];
343
- };
334
+ dragCursor?: CSSProperties['cursor'];
344
335
  /**
345
336
  * How much one notch of the wheel moves the value. It only acts while the
346
337
  * focus is inside, so that scrolling the page past the knob leaves it alone.
@@ -401,11 +392,6 @@ interface KnobProps {
401
392
  * @default { default: ['raw', 1], shift: ['raw', 0.1] }
402
393
  */
403
394
  keyboard?: ModifierValue<InputEventOption> | null;
404
- /**
405
- * Restore `defaultValue` on a double click.
406
- * @default true
407
- */
408
- enableDoubleClickDefault?: boolean;
409
395
  /**
410
396
  * Make the knob unchangeable and remove it from the tab order.
411
397
  * The parts carry `data-disabled` while it is set.
@@ -415,7 +401,7 @@ interface KnobProps {
415
401
  * Make the knob unchangeable while leaving it focusable.
416
402
  * The parts carry `data-readonly` while it is set.
417
403
  */
418
- readonly?: boolean;
404
+ readOnly?: boolean;
419
405
  /**
420
406
  * How far the knob turns from `min` to `max`, in degrees, centred on the
421
407
  * top.
@@ -427,6 +413,25 @@ interface KnobProps {
427
413
  * click moves it.
428
414
  */
429
415
  onChange?: (value: number) => void;
416
+ /**
417
+ * Called when a change of the value starts — a drag, a double click, the first wheel notch
418
+ * or arrow key — with the value
419
+ * before it and what it is made with. A host recording automation can treat
420
+ * the control as touched from here until `onChangeEnd`.
421
+ */
422
+ onChangeStart?: (value: number, source: ChangeSource) => void;
423
+ /**
424
+ * Called when the change ends, with the value it ended on: on release, or
425
+ * `changeEndDelay` after the last wheel notch or arrow key.
426
+ */
427
+ onChangeEnd?: (value: number, source: ChangeSource) => void;
428
+ /**
429
+ * How long after the last wheel notch or arrow key the change counts as
430
+ * over, in milliseconds. Neither has an event that says it is done.
431
+ *
432
+ * @default 500
433
+ */
434
+ changeEndDelay?: number;
430
435
  /**
431
436
  * The knob renders exactly what you compose here; there is no default
432
437
  * markup to fall back to.
@@ -442,6 +447,12 @@ interface KnobProps {
442
447
  */
443
448
  children: ReactNode;
444
449
  style?: CSSProperties & CSSVariables<'knob-size'>;
450
+ /**
451
+ * Receives `focus` and `blur`. They do nothing while the knob is disabled,
452
+ * where the element's own `focus()` would still focus it. `ref` reaches the
453
+ * root element itself.
454
+ */
455
+ actionsRef?: Ref<KnobMethods>;
445
456
  }
446
457
  interface KnobMethods {
447
458
  focus: () => void;
@@ -451,7 +462,7 @@ interface KnobMethods {
451
462
  * Interactive rotary knob component implemented in SVG.
452
463
  */
453
464
  export declare const Knob: {
454
- Root: import("react").ForwardRefExoticComponent<KnobProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof KnobProps> & import("react").RefAttributes<KnobMethods>>;
465
+ Root: import("react").ForwardRefExoticComponent<KnobProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof KnobProps> & import("react").RefAttributes<HTMLDivElement>>;
455
466
  SVGRoot: typeof SVGRoot;
456
467
  InactiveLine: typeof InactiveLine;
457
468
  ActiveLine: typeof ActiveLine;
@@ -489,7 +500,7 @@ type NumberInputContextValue = {
489
500
  /** How the value is distributed across the travel. */
490
501
  scale: Scale;
491
502
  disabled: boolean;
492
- readonly: boolean;
503
+ readOnly: boolean;
493
504
  clampValue: boolean;
494
505
  /**
495
506
  * The effective scaling for `applyDelta`, with unbounded ends filled in.
@@ -505,6 +516,8 @@ type NumberInputContextValue = {
505
516
  dragSensitivity: ModifierValue<number>;
506
517
  /** Whether a `Stepper` drag hides the pointer and reads its movement. */
507
518
  pointerLock: boolean;
519
+ /** The cursor shown while a `Stepper` is dragged. */
520
+ dragCursor: CSSProperties['cursor'];
508
521
  /** What `InputField` selects when it takes focus. */
509
522
  selectOnFocus: 'all' | 'number' | 'none';
510
523
  /** Whether `InputField` shows the plain value while it has focus. */
@@ -664,6 +677,13 @@ interface NumberInputProps {
664
677
  * @default false
665
678
  */
666
679
  pointerLock?: boolean;
680
+ /**
681
+ * The cursor to show while dragging a `Stepper`. It is set on the stepper
682
+ * being dragged, so it stays while the pointer is outside it.
683
+ *
684
+ * @default 'ns-resize'
685
+ */
686
+ dragCursor?: CSSProperties['cursor'];
667
687
  /**
668
688
  * Select the text when `InputField` takes focus: `'all'` selects all of it,
669
689
  * `'number'` only the number, leaving the unit the format put around it,
@@ -719,13 +739,34 @@ interface NumberInputProps {
719
739
  * Make the value unchangeable.
720
740
  * The parts carry `data-readonly` while it is set.
721
741
  */
722
- readonly?: boolean;
742
+ readOnly?: boolean;
723
743
  /**
724
744
  * Called with the new value. While the user types, it is called for every
725
745
  * entry that reads as a number, unclamped; committing the entry calls it
726
746
  * again if clamping changes the value.
727
747
  */
728
748
  onChange?: (value: number) => void;
749
+ /**
750
+ * Called when a change of the value starts — a press on a stepper, the
751
+ * first wheel notch, arrow key or typed character — with the value before
752
+ * it and what it is made with. A host recording automation can treat the
753
+ * input as touched from here until `onChangeEnd`.
754
+ */
755
+ onChangeStart?: (value: number, source: ChangeSource) => void;
756
+ /**
757
+ * Called when the change ends, with the value it ended on: when the stepper
758
+ * is released, when typed text is committed, or `changeEndDelay` after the
759
+ * last wheel notch or arrow key.
760
+ */
761
+ onChangeEnd?: (value: number, source: ChangeSource) => void;
762
+ /**
763
+ * How long after the last wheel notch, arrow key or typed character the
764
+ * change counts as over, in milliseconds. None of them has an event that
765
+ * says it is done.
766
+ *
767
+ * @default 500
768
+ */
769
+ changeEndDelay?: number;
729
770
  /**
730
771
  * The input renders exactly what you compose here; there is no default
731
772
  * markup to fall back to.
@@ -740,6 +781,12 @@ interface NumberInputProps {
740
781
  * </NumberInput.Root>
741
782
  */
742
783
  children: ReactNode;
784
+ /**
785
+ * Receives `focus` and `blur`, which act on the input of `InputField` — the
786
+ * element that takes the focus — and do nothing while
787
+ * the input is disabled. `ref` reaches the root element itself.
788
+ */
789
+ actionsRef?: Ref<NumberInputMethods>;
743
790
  }
744
791
  interface NumberInputMethods {
745
792
  focus: () => void;
@@ -749,11 +796,11 @@ interface NumberInputMethods {
749
796
  * Input with some useful functions for entering numerical values.
750
797
  */
751
798
  export declare const NumberInput: {
752
- Root: import("react").ForwardRefExoticComponent<NumberInputProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof NumberInputProps> & import("react").RefAttributes<NumberInputMethods>>;
799
+ Root: import("react").ForwardRefExoticComponent<NumberInputProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof NumberInputProps> & import("react").RefAttributes<HTMLDivElement>>;
753
800
  InputField: import("react").ForwardRefExoticComponent<{
754
801
  form?: string | undefined | undefined;
755
802
  slot?: string | undefined | undefined;
756
- style?: import("react").CSSProperties | undefined;
803
+ style?: CSSProperties | undefined;
757
804
  title?: string | undefined | undefined;
758
805
  pattern?: string | undefined | undefined;
759
806
  key?: import("react").Key | null | undefined;
@@ -764,7 +811,7 @@ export declare const NumberInput: {
764
811
  autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
765
812
  autoFocus?: boolean | undefined | undefined;
766
813
  className?: string | undefined | undefined;
767
- contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
814
+ contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
768
815
  contextMenu?: string | undefined | undefined;
769
816
  dir?: string | undefined | undefined;
770
817
  draggable?: (boolean | "true" | "false") | undefined;
@@ -1033,15 +1080,17 @@ export declare const NumberInput: {
1033
1080
  onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLInputElement> | undefined;
1034
1081
  onTransitionStart?: import("react").TransitionEventHandler<HTMLInputElement> | undefined;
1035
1082
  onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLInputElement> | undefined;
1036
- accept?: string | undefined | undefined;
1037
- multiple?: boolean | undefined | undefined;
1038
- disabled?: boolean | undefined | undefined;
1039
- height?: number | string | undefined | undefined;
1040
- width?: number | string | undefined | undefined;
1041
1083
  min?: number | string | undefined | undefined;
1042
1084
  max?: number | string | undefined | undefined;
1043
1085
  step?: number | string | undefined | undefined;
1086
+ disabled?: boolean | undefined | undefined;
1087
+ readOnly?: boolean | undefined | undefined;
1044
1088
  alt?: string | undefined | undefined;
1089
+ height?: number | string | undefined | undefined;
1090
+ width?: number | string | undefined | undefined;
1091
+ accept?: string | undefined | undefined;
1092
+ multiple?: boolean | undefined | undefined;
1093
+ size?: number | undefined | undefined;
1045
1094
  autoComplete?: import("react").HTMLInputAutoCompleteAttribute | undefined;
1046
1095
  capture?: boolean | "user" | "environment" | undefined | undefined;
1047
1096
  checked?: boolean | undefined | undefined;
@@ -1055,9 +1104,7 @@ export declare const NumberInput: {
1055
1104
  minLength?: number | undefined | undefined;
1056
1105
  name?: string | undefined | undefined;
1057
1106
  placeholder?: string | undefined | undefined;
1058
- readOnly?: boolean | undefined | undefined;
1059
1107
  required?: boolean | undefined | undefined;
1060
- size?: number | undefined | undefined;
1061
1108
  src?: string | undefined | undefined;
1062
1109
  } & import("react").RefAttributes<HTMLInputElement>>;
1063
1110
  Stepper: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1183,6 +1230,11 @@ interface PianoProps {
1183
1230
  onPlayNote?: (note: number, velocity?: number) => void;
1184
1231
  /** Called once everything holding a note has let go of it. */
1185
1232
  onStopNote?: (note: number) => void;
1233
+ /**
1234
+ * Receives `playNote` and `stopNote`, which press and release a key as the
1235
+ * pointer or the keyboard would. `ref` reaches the root element itself.
1236
+ */
1237
+ actionsRef?: Ref<PianoMethods>;
1186
1238
  }
1187
1239
  interface PianoMethods {
1188
1240
  playNote: (note: number, velocity?: number) => void;
@@ -1192,7 +1244,7 @@ interface PianoMethods {
1192
1244
  * Customizable piano component.
1193
1245
  */
1194
1246
  export declare const Piano: {
1195
- Root: import("react").ForwardRefExoticComponent<PianoProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof PianoProps> & import("react").RefAttributes<PianoMethods>>;
1247
+ Root: import("react").ForwardRefExoticComponent<PianoProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof PianoProps> & import("react").RefAttributes<HTMLDivElement>>;
1196
1248
  };
1197
1249
  //#endregion
1198
1250
  //#region src/components/PointsEditor/Background.d.ts
@@ -1219,8 +1271,8 @@ interface PointsEditorPointProps<T extends PointPosition> {
1219
1271
  color?: string;
1220
1272
  /** Overrides the `disabled` of `PointsEditor.Root`. */
1221
1273
  disabled?: boolean;
1222
- /** Overrides the `readonly` of `PointsEditor.Root`. */
1223
- readonly?: boolean;
1274
+ /** Overrides the `readOnly` of `PointsEditor.Root`. */
1275
+ readOnly?: boolean;
1224
1276
  /** Overrides the `wheel` of `PointsEditor.Root`. */
1225
1277
  wheel?: ModifierValue<InputEventOption> | null;
1226
1278
  /** Overrides the `keyboard` of `PointsEditor.Root`. */
@@ -1237,13 +1289,28 @@ interface PointsEditorPointProps<T extends PointPosition> {
1237
1289
  * arrow keys or the wheel, including when it moves along with a selection.
1238
1290
  */
1239
1291
  onChange?: (value: PointPosition) => void;
1240
- /** Called when a drag on this point starts, with where the point is. */
1241
- onDragStart?: (value: PointPosition) => void;
1242
- /** Called when that drag ends, with where the point is. */
1243
- onDragEnd?: (value: PointPosition) => void;
1292
+ /**
1293
+ * Called when a change of this point starts — a drag on it, the first wheel
1294
+ * notch or arrow key while it has the focus — with where it is and what the
1295
+ * change is made with. The points that move along with a selection report
1296
+ * through `onChange` only: the change belongs to the point being operated.
1297
+ */
1298
+ onChangeStart?: (value: PointPosition, source: ChangeSource) => void;
1299
+ /**
1300
+ * Called when that change ends, with where the point is: on release, or
1301
+ * `changeEndDelay` after the last wheel notch or arrow key.
1302
+ */
1303
+ onChangeEnd?: (value: PointPosition, source: ChangeSource) => void;
1304
+ /**
1305
+ * How long after the last wheel notch or arrow key the change counts as
1306
+ * over, in milliseconds. Neither has an event that says it is done.
1307
+ *
1308
+ * @default 500
1309
+ */
1310
+ changeEndDelay?: number;
1244
1311
  style?: CSSProperties & CSSVariables<'color' | 'translate'>;
1245
1312
  }
1246
- declare function Point<T extends PointPosition>({ value, children, id: idProp, min, max, color, disabled: _disabled, readonly: _readonly, wheel: _wheel, keyboard: _keyboard, 'aria-label': ariaLabel, 'aria-valuetext': ariaValuetext, onChange, onDragStart, onDragEnd, className, style, onPointerDown, onKeyDown, onFocus, ...props }: PointsEditorPointProps<T> & Omit<ComponentPropsWithoutRef<'div'>, keyof PointsEditorPointProps<T>>): import("react").JSX.Element;
1313
+ declare function Point<T extends PointPosition>({ value, children, id: idProp, min, max, color, disabled: _disabled, readOnly: _readOnly, wheel: _wheel, keyboard: _keyboard, 'aria-label': ariaLabel, 'aria-valuetext': ariaValuetext, onChange, onChangeStart, onChangeEnd, changeEndDelay, className, style, onPointerDown, onKeyDown, onFocus, ...props }: PointsEditorPointProps<T> & Omit<ComponentPropsWithoutRef<'div'>, keyof PointsEditorPointProps<T>>): import("react").JSX.Element;
1247
1314
  //#endregion
1248
1315
  //#region src/components/PointsEditor/SelectionBox.d.ts
1249
1316
  /**
@@ -1257,16 +1324,15 @@ declare function SelectionBox({ children, className, style, ...props }: Componen
1257
1324
  //#region src/components/PointsEditor/context.d.ts
1258
1325
  type PointsEditorContextValue = {
1259
1326
  disabled: boolean;
1260
- readonly: boolean;
1327
+ readOnly: boolean;
1261
1328
  /** Inherited by every `Point`; `null` turns the wheel off. */
1262
1329
  wheel: ModifierValue<InputEventOption> | null;
1263
1330
  /** Inherited by every `Point`; `null` turns the keyboard off. */
1264
1331
  keyboard: ModifierValue<InputEventOption> | null;
1265
1332
  /** Inherited by every `Point`. See `PointsEditorProps.dragSensitivity`. */
1266
1333
  dragSensitivity: ModifierValue<number>;
1267
- externalStyles: {
1268
- cursor?: CSSProperties['cursor'];
1269
- };
1334
+ /** Inherited by every `Point`. See `PointsEditorProps.dragCursor`. */
1335
+ dragCursor: CSSProperties['cursor'];
1270
1336
  /**
1271
1337
  * `Container` registers its element here; `Point` normalizes the pointer
1272
1338
  * against it, so a point is placed by its position within the container.
@@ -1304,16 +1370,14 @@ interface PointsEditorProps {
1304
1370
  * Make the points unmovable.
1305
1371
  * The parts carry `data-readonly` while it is set.
1306
1372
  */
1307
- readonly?: boolean;
1373
+ readOnly?: boolean;
1308
1374
  /**
1309
1375
  * The cursor to show while dragging a point. It is set on the dragged
1310
1376
  * point, so it stays while the pointer is outside it.
1311
1377
  *
1312
- * @default { cursor: 'grabbing' }
1378
+ * @default 'grabbing'
1313
1379
  */
1314
- externalStyles?: {
1315
- cursor?: CSSProperties['cursor'];
1316
- };
1380
+ dragCursor?: CSSProperties['cursor'];
1317
1381
  /**
1318
1382
  * How much one notch of the wheel moves the focused `Point`. Scrolling
1319
1383
  * sideways, or with shift held, moves x; otherwise it moves y.
@@ -1427,6 +1491,11 @@ interface SliderThumbProps {
1427
1491
  */
1428
1492
  color?: string;
1429
1493
  style?: CSSProperties & CSSVariables<'color' | 'translate'>;
1494
+ /**
1495
+ * Receives `focus` and `blur` for the range input inside, which do nothing
1496
+ * while the slider is disabled. `ref` reaches the thumb element itself.
1497
+ */
1498
+ actionsRef?: Ref<SliderThumbMethods>;
1430
1499
  }
1431
1500
  interface SliderThumbMethods {
1432
1501
  focus: () => void;
@@ -1442,11 +1511,11 @@ interface SliderTrackProps {
1442
1511
  length?: number | string;
1443
1512
  /** How thick the track is across that axis. Sets `--thickness`. */
1444
1513
  thickness?: number | string;
1445
- /** Colour of the part from `min` to the value. Sets `--active`. */
1446
- active?: string;
1447
- /** Colour of the rest of the track. Sets `--inactive`. */
1448
- inactive?: string;
1449
- style?: CSSProperties & CSSVariables<'length' | 'thickness' | 'active' | 'inactive' | 'percent'>;
1514
+ /** Colour of the part from `min` to the value. Sets `--active-color`. */
1515
+ activeColor?: string;
1516
+ /** Colour of the rest of the track. Sets `--inactive-color`. */
1517
+ inactiveColor?: string;
1518
+ style?: CSSProperties & CSSVariables<'length' | 'thickness' | 'active-color' | 'inactive-color' | 'percent'>;
1450
1519
  }
1451
1520
  //#endregion
1452
1521
  //#region src/components/Slider/Marks.d.ts
@@ -1511,14 +1580,14 @@ type SliderContextValue = {
1511
1580
  step: number;
1512
1581
  /** How the value is distributed across the travel. */
1513
1582
  scale: Scale;
1514
- vertical: boolean;
1583
+ orientation: 'horizontal' | 'vertical';
1515
1584
  reverse: boolean;
1516
1585
  disabled: boolean;
1517
- readonly: boolean;
1586
+ readOnly: boolean;
1518
1587
  onChange?: (value: number) => void;
1519
1588
  /**
1520
1589
  * Position of the thumb, 0-100, already accounting for the display direction
1521
- * implied by `vertical` and `reverse`.
1590
+ * implied by `orientation` and `reverse`.
1522
1591
  */
1523
1592
  percent: number;
1524
1593
  /** `Track` registers its element here; `Root` normalizes the pointer against it. */
@@ -1559,14 +1628,15 @@ interface SliderProps {
1559
1628
  */
1560
1629
  scale?: Scale;
1561
1630
  /**
1562
- * Run the slider vertically, with the value growing upwards. The range input
1563
- * inside the thumb takes its `aria-orientation` from this.
1631
+ * Which way the slider runs. A vertical slider grows upwards. Every part
1632
+ * carries the same value as `data-orientation`, and the range input inside
1633
+ * the thumb takes its `aria-orientation` from it.
1564
1634
  *
1565
- * @default false
1635
+ * @default 'horizontal'
1566
1636
  */
1567
- vertical?: boolean;
1637
+ orientation?: 'horizontal' | 'vertical';
1568
1638
  /**
1569
- * Grow the value the other way: leftwards, or downwards when `vertical`.
1639
+ * Grow the value the other way: leftwards, or downwards when vertical.
1570
1640
  * The arrow keys follow the direction on screen.
1571
1641
  *
1572
1642
  * @default false
@@ -1576,11 +1646,9 @@ interface SliderProps {
1576
1646
  * The cursor to show while dragging. It is set on the dragged element, so it
1577
1647
  * stays while the pointer is outside the slider.
1578
1648
  *
1579
- * @default { cursor: 'pointer' }
1649
+ * @default 'pointer'
1580
1650
  */
1581
- externalStyles?: {
1582
- cursor?: CSSProperties['cursor'];
1583
- };
1651
+ dragCursor?: CSSProperties['cursor'];
1584
1652
  /**
1585
1653
  * How much one notch of the wheel moves the value. It only acts while the
1586
1654
  * focus is inside, so that scrolling the page past the slider leaves it
@@ -1635,13 +1703,28 @@ interface SliderProps {
1635
1703
  * Make the value unchangeable.
1636
1704
  * The parts carry `data-readonly` while it is set.
1637
1705
  */
1638
- readonly?: boolean;
1706
+ readOnly?: boolean;
1639
1707
  /** Called with the new value when a drag, the wheel or an arrow key moves it. */
1640
1708
  onChange?: (value: number) => void;
1641
- /** Called when a drag starts, with the value where the track was pressed. */
1642
- onDragStart?: (value: number) => void;
1643
- /** Called when the drag ends, with the value it ended on. */
1644
- onDragEnd?: (value: number) => void;
1709
+ /**
1710
+ * Called when a change of the value starts — a press on the track, the first wheel notch
1711
+ * or arrow key — with the value
1712
+ * before it and what it is made with. A host recording automation can treat
1713
+ * the control as touched from here until `onChangeEnd`.
1714
+ */
1715
+ onChangeStart?: (value: number, source: ChangeSource) => void;
1716
+ /**
1717
+ * Called when the change ends, with the value it ended on: on release, or
1718
+ * `changeEndDelay` after the last wheel notch or arrow key.
1719
+ */
1720
+ onChangeEnd?: (value: number, source: ChangeSource) => void;
1721
+ /**
1722
+ * How long after the last wheel notch or arrow key the change counts as
1723
+ * over, in milliseconds. Neither has an event that says it is done.
1724
+ *
1725
+ * @default 500
1726
+ */
1727
+ changeEndDelay?: number;
1645
1728
  /**
1646
1729
  * The slider renders exactly what you compose here; there is no default
1647
1730
  * markup to fall back to.
@@ -1654,6 +1737,12 @@ interface SliderProps {
1654
1737
  * </Slider.Root>
1655
1738
  */
1656
1739
  children: ReactNode;
1740
+ /**
1741
+ * Receives `focus` and `blur`, which act on the range input inside the thumb —
1742
+ * the element that takes the focus — and do nothing while the slider is
1743
+ * disabled. `ref` reaches the root element itself.
1744
+ */
1745
+ actionsRef?: Ref<SliderMethods>;
1657
1746
  }
1658
1747
  interface SliderMethods {
1659
1748
  focus: () => void;
@@ -1663,8 +1752,8 @@ interface SliderMethods {
1663
1752
  * Customizable slider
1664
1753
  */
1665
1754
  export declare const Slider: {
1666
- Root: React.ForwardRefExoticComponent<SliderProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SliderProps> & React.RefAttributes<SliderMethods>>;
1667
- Thumb: React.ForwardRefExoticComponent<SliderThumbProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SliderThumbProps> & React.RefAttributes<SliderThumbMethods>>;
1755
+ Root: React.ForwardRefExoticComponent<SliderProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SliderProps> & React.RefAttributes<HTMLDivElement>>;
1756
+ Thumb: React.ForwardRefExoticComponent<SliderThumbProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SliderThumbProps> & React.RefAttributes<HTMLDivElement>>;
1668
1757
  Track: React.ForwardRefExoticComponent<SliderTrackProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof SliderTrackProps> & React.RefAttributes<HTMLDivElement>>;
1669
1758
  Marks: typeof Marks;
1670
1759
  MarksOption: typeof MarksOption;
@@ -1694,6 +1783,11 @@ interface XYPadThumbProps {
1694
1783
  */
1695
1784
  'aria-valuetext'?: XYInput<AriaAttributes['aria-valuetext']>;
1696
1785
  style?: CSSProperties & CSSVariables<'color' | 'translate'>;
1786
+ /**
1787
+ * Receives `focus` and `blur` for the range inputs inside, which do nothing
1788
+ * while the pad is disabled. `ref` reaches the thumb element itself.
1789
+ */
1790
+ actionsRef?: Ref<XYPadThumbMethods>;
1697
1791
  }
1698
1792
  interface XYPadThumbMethods {
1699
1793
  focus: () => void;
@@ -1710,7 +1804,7 @@ type XYPadContextValue = {
1710
1804
  scale: XY<Scale>;
1711
1805
  reverse: XY<boolean>;
1712
1806
  disabled: boolean;
1713
- readonly: boolean;
1807
+ readOnly: boolean;
1714
1808
  onChange?: (value: XY<number>) => void;
1715
1809
  /**
1716
1810
  * Position of the thumb, 0-100 per axis, already accounting for `reverse`.
@@ -1817,11 +1911,9 @@ interface XYPadProps {
1817
1911
  * The cursor to show while dragging. It is set on the dragged element, so it
1818
1912
  * stays while the pointer is outside the pad.
1819
1913
  *
1820
- * @default { cursor: 'pointer' }
1914
+ * @default 'pointer'
1821
1915
  */
1822
- externalStyles?: {
1823
- cursor?: CSSProperties['cursor'];
1824
- };
1916
+ dragCursor?: CSSProperties['cursor'];
1825
1917
  /**
1826
1918
  * Make the pad unchangeable and remove its thumb from the tab order.
1827
1919
  * The parts carry `data-disabled` while it is set.
@@ -1831,13 +1923,28 @@ interface XYPadProps {
1831
1923
  * Make the pad unchangeable while leaving its thumb focusable.
1832
1924
  * The parts carry `data-readonly` while it is set.
1833
1925
  */
1834
- readonly?: boolean;
1926
+ readOnly?: boolean;
1835
1927
  /** Called with the new value when a drag, the wheel or an arrow key moves it. */
1836
1928
  onChange?: (value: XY<number>) => void;
1837
- /** Called when a drag starts, with the value where the area was pressed. */
1838
- onDragStart?: (value: XY<number>) => void;
1839
- /** Called when the drag ends, with the value it ended on. */
1840
- onDragEnd?: (value: XY<number>) => void;
1929
+ /**
1930
+ * Called when a change of the value starts — a press on the area, the first wheel notch
1931
+ * or arrow key — with the value
1932
+ * before it and what it is made with. A host recording automation can treat
1933
+ * the control as touched from here until `onChangeEnd`.
1934
+ */
1935
+ onChangeStart?: (value: XY<number>, source: ChangeSource) => void;
1936
+ /**
1937
+ * Called when the change ends, with the value it ended on: on release, or
1938
+ * `changeEndDelay` after the last wheel notch or arrow key.
1939
+ */
1940
+ onChangeEnd?: (value: XY<number>, source: ChangeSource) => void;
1941
+ /**
1942
+ * How long after the last wheel notch or arrow key the change counts as
1943
+ * over, in milliseconds. Neither has an event that says it is done.
1944
+ *
1945
+ * @default 500
1946
+ */
1947
+ changeEndDelay?: number;
1841
1948
  /**
1842
1949
  * The pad renders exactly what you compose here; there is no default
1843
1950
  * markup to fall back to.
@@ -1850,23 +1957,46 @@ interface XYPadProps {
1850
1957
  * </XYPad.Root>
1851
1958
  */
1852
1959
  children: ReactNode;
1960
+ /**
1961
+ * Receives `focus` and `blur`, which act on the range inputs inside the thumb —
1962
+ * the elements that take the focus — and do nothing while
1963
+ * the pad is disabled. `ref` reaches the root element itself.
1964
+ */
1965
+ actionsRef?: Ref<XYPadMethods>;
1853
1966
  }
1854
1967
  interface XYPadMethods {
1855
1968
  focus: () => void;
1856
1969
  blur: () => void;
1857
- original: Ref<HTMLDivElement>;
1858
1970
  }
1859
1971
  /**
1860
1972
  * Simple XYPad
1861
1973
  */
1862
1974
  export declare const XYPad: {
1863
- Root: import("react").ForwardRefExoticComponent<XYPadProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof XYPadProps> & import("react").RefAttributes<XYPadMethods>>;
1864
- Thumb: import("react").ForwardRefExoticComponent<XYPadThumbProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof XYPadThumbProps> & import("react").RefAttributes<XYPadThumbMethods>>;
1975
+ Root: import("react").ForwardRefExoticComponent<XYPadProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof XYPadProps> & import("react").RefAttributes<HTMLDivElement>>;
1976
+ Thumb: import("react").ForwardRefExoticComponent<XYPadThumbProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof XYPadThumbProps> & import("react").RefAttributes<HTMLDivElement>>;
1865
1977
  Area: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
1866
1978
  };
1867
1979
  //#endregion
1868
1980
  //#region src/hooks/useAnimationFrame.d.ts
1869
- export declare function useAnimationFrame(callback?: () => void, deps?: DependencyList): void;
1981
+ interface UseAnimationFrameOptions {
1982
+ /**
1983
+ * Stop the loop. Turning it back on starts a new one, whose first frame has
1984
+ * a `deltaTime` of `0`.
1985
+ * @default false
1986
+ */
1987
+ disabled?: boolean;
1988
+ }
1989
+ /**
1990
+ * Call `callback` on every animation frame for as long as the component is
1991
+ * mounted.
1992
+ *
1993
+ * The callback is read on every frame, so it can be written inline and see
1994
+ * the latest render without restarting the loop.
1995
+ *
1996
+ * @param callback receives the frame's timestamp and the milliseconds since
1997
+ * the previous frame, which is `0` on the first one
1998
+ */
1999
+ export declare function useAnimationFrame(callback: (timestamp: DOMHighResTimeStamp, deltaTime: number) => void, { disabled }?: UseAnimationFrameOptions): void;
1870
2000
  //#endregion
1871
2001
  //#region src/hooks/useDrag.d.ts
1872
2002
  interface UseDragOptions {
@@ -2017,14 +2147,30 @@ export declare function useDropZone<T extends Element>({ accept, multiple, disab
2017
2147
  };
2018
2148
  //#endregion
2019
2149
  //#region src/hooks/useEventListener.d.ts
2020
- type Target = EventTarget | null | (() => EventTarget | null);
2021
- type Options = boolean | AddEventListenerOptions;
2022
- export declare function useEventListener<K extends keyof DocumentEventMap>(target: Target, event: K, handler: (event: DocumentEventMap[K]) => void, options?: Options): VoidFunction;
2023
- export declare function useEventListener<K extends keyof WindowEventMap>(target: Target, event: K, handler: (event: WindowEventMap[K]) => void, options?: Options): VoidFunction;
2024
- export declare function useEventListener<K extends keyof GlobalEventHandlersEventMap>(target: Target, event: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, options?: Options): VoidFunction;
2025
- //#endregion
2026
- //#region src/hooks/useInterval.d.ts
2027
- export declare function useInterval(callback: () => void, delay: number | null): void;
2150
+ /**
2151
+ * What {@link useEventListener} listens on. A function is called after every
2152
+ * render, so it can return an element out of a ref; `null` listens on nothing.
2153
+ */
2154
+ type UseEventListenerTarget = EventTarget | null | (() => EventTarget | null);
2155
+ /**
2156
+ * The options of `addEventListener`, as a boolean for `capture` or as an
2157
+ * object. `signal` is left out: the hook already owns when the listener goes.
2158
+ */
2159
+ type UseEventListenerOptions = boolean | Pick<AddEventListenerOptions, 'capture' | 'once' | 'passive'>;
2160
+ /**
2161
+ * Listen to an event on a target for as long as the component is mounted.
2162
+ *
2163
+ * The handler is read on every event, and the target and the options are
2164
+ * compared by what they resolve to, so all three can be written inline. The
2165
+ * listener is re-attached only when the element, the event or one of the
2166
+ * options actually changes.
2167
+ *
2168
+ * @returns a function that removes the listener. It stays removed until the
2169
+ * target, the event or the options change.
2170
+ */
2171
+ export declare function useEventListener<K extends keyof DocumentEventMap>(target: UseEventListenerTarget, event: K, handler: (event: DocumentEventMap[K]) => void, options?: UseEventListenerOptions): VoidFunction;
2172
+ export declare function useEventListener<K extends keyof WindowEventMap>(target: UseEventListenerTarget, event: K, handler: (event: WindowEventMap[K]) => void, options?: UseEventListenerOptions): VoidFunction;
2173
+ export declare function useEventListener<K extends keyof GlobalEventHandlersEventMap>(target: UseEventListenerTarget, event: K, handler: (event: GlobalEventHandlersEventMap[K]) => void, options?: UseEventListenerOptions): VoidFunction;
2028
2174
  //#endregion
2029
2175
  //#region src/hooks/useLongPress.d.ts
2030
2176
  /**
@@ -2109,5 +2255,5 @@ interface UseWheelOptions extends Omit<WheelOptions, 'onWheel'> {
2109
2255
  */
2110
2256
  export declare function useWheel<T extends Element>(onWheel: (event: WheelEvent) => void, { requireFocus, target }?: UseWheelOptions): (node: T | null) => void;
2111
2257
  //#endregion
2112
- export type { AnimationCanvasCommonProps, AnimationCanvasFixedProps, AnimationCanvasProps, AnimationCanvasResizableProps, CSSVariables, DrawFunction, DropZoneProps, FileInputContextValue, FileInputProps, FileInputTriggerProps, InitFunction, KeyAttributes, KeyState, KnobContextValue, KnobMethods, KnobProps, KnobSVGRootProps, KnobThumbProps, NumberInputContextValue, NumberInputMethods, NumberInputProps, PianoMethods, PianoProps, PointsEditorContextValue, PointsEditorPointProps, PointsEditorProps, SliderContextValue, SliderMarksOptionProps, SliderMarksProps, SliderMethods, SliderProps, SliderThumbMethods, SliderThumbProps, SliderTrackProps, UseDragOptions, UseDragValueOptions, UseDropZoneOptions, UseWheelOptions, XYPadContextValue, XYPadMethods, XYPadProps, XYPadThumbMethods, XYPadThumbProps };
2258
+ export type { AnimationCanvasCommonProps, AnimationCanvasFixedProps, AnimationCanvasProps, AnimationCanvasResizableProps, CSSVariables, DropZoneProps, FileInputContextValue, FileInputProps, FileInputTriggerProps, KeyAttributes, KeyState, KnobContextValue, KnobMethods, KnobProps, KnobSVGRootProps, KnobThumbProps, NumberInputContextValue, NumberInputMethods, NumberInputProps, PianoMethods, PianoProps, PointsEditorContextValue, PointsEditorPointProps, PointsEditorProps, SliderContextValue, SliderMarksOptionProps, SliderMarksProps, SliderMethods, SliderProps, SliderThumbMethods, SliderThumbProps, SliderTrackProps, UseAnimationFrameOptions, UseDragOptions, UseDragValueOptions, UseDropZoneOptions, UseEventListenerOptions, UseEventListenerTarget, UseWheelOptions, XYPadContextValue, XYPadMethods, XYPadProps, XYPadThumbMethods, XYPadThumbProps };
2113
2259
  //# sourceMappingURL=index.d.cts.map