@tremolo-ui/react 0.0.7 → 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 +674 -253
  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 +3 -4
  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 +10 -0
  46. package/dist/cjs/types/index.d.ts.map +1 -1
  47. package/dist/esm/index.js +657 -254
  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 +3 -4
  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 +10 -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 +76 -59
  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 +11 -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
@@ -1,108 +1,114 @@
1
- import { css } from "@emotion/react"
2
- import React, { forwardRef, useImperativeHandle, useRef, useState } from "react"
1
+ import clsx from 'clsx'
2
+ import React, {
3
+ ComponentPropsWithoutRef,
4
+ forwardRef,
5
+ useImperativeHandle,
6
+ useState,
7
+ } from 'react'
3
8
 
4
- import { KeyLabel } from "./KeyLabel"
5
- import { KeyMethods, KeyProps } from "./key"
9
+ import { KeyMethods, KeyProps } from './key'
10
+ import { KeyLabel, KeyLabelProps } from './KeyLabel'
6
11
 
7
- export const BlackKey = forwardRef<KeyMethods, KeyProps>(({
8
- width = 40 * 0.65,
9
- height = '60%',
10
- bg = '#333',
11
- activeBg = '#666',
12
- style,
13
- children,
14
- __glissando,
15
- __position,
16
- __note,
17
- __disabled,
18
- __index,
19
- __fill,
20
- __width,
21
- __playNote,
22
- __stopNote,
23
- __label,
24
- }: KeyProps, ref) => {
25
- const [played, setPlayed] = useState(false)
12
+ type Props = KeyProps & Omit<ComponentPropsWithoutRef<'div'>, keyof KeyProps>
26
13
 
27
- useImperativeHandle(ref, () => {
28
- return {
29
- play() {
30
- if (__disabled) return
31
- setPlayed(true)
32
- if (__playNote) __playNote(__note!)
33
- },
34
- stop() {
35
- setPlayed(false)
36
- if (__stopNote) __stopNote(__note!)
37
- },
38
- played() {
39
- return played
14
+ export const BlackKey = forwardRef<KeyMethods, Props>(
15
+ (
16
+ {
17
+ width = 40 * 0.65,
18
+ height = '60%',
19
+ className,
20
+ style,
21
+ children,
22
+ __glissando,
23
+ __position,
24
+ __note,
25
+ __disabled,
26
+ __index,
27
+ __fill,
28
+ __width,
29
+ __playNote,
30
+ __stopNote,
31
+ __label,
32
+ ...props
33
+ }: Props,
34
+ ref,
35
+ ) => {
36
+ const [played, setPlayed] = useState(false)
37
+
38
+ useImperativeHandle(ref, () => {
39
+ return {
40
+ play() {
41
+ if (__disabled) return
42
+ setPlayed(true)
43
+ if (__playNote) __playNote(__note!)
44
+ },
45
+ stop() {
46
+ setPlayed(false)
47
+ if (__stopNote) __stopNote(__note!)
48
+ },
49
+ played() {
50
+ return played
51
+ },
40
52
  }
41
- }
42
- }, [])
53
+ }, [__disabled, __note, __playNote, __stopNote, played])
43
54
 
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- let keyLabelProps: any
46
- if (children != undefined) {
47
- React.Children.forEach(children, (child) => {
48
- if (React.isValidElement(child)) {
49
- if (child.type == KeyLabel) {
50
- keyLabelProps = child.props
55
+ let keyLabelProps: KeyLabelProps = {}
56
+ if (children != undefined) {
57
+ React.Children.forEach(children, (child) => {
58
+ if (React.isValidElement(child)) {
59
+ if (child.type == KeyLabel) {
60
+ keyLabelProps = child.props as KeyLabelProps
61
+ } else {
62
+ throw new Error('only <KeyLabel>')
63
+ }
51
64
  } else {
52
- throw new Error('only <KeyLabel>')
65
+ throw new Error('children is an invalid element.')
53
66
  }
54
- } else {
55
- throw new Error('children is an invalid element.')
56
- }
57
- })
58
- }
67
+ })
68
+ }
59
69
 
60
- return (
61
- <div
62
- className={`tremolo-piano-black-key`}
63
- aria-disabled={__disabled}
64
- css={css({
65
- position: 'absolute',
66
- backgroundColor: played ? activeBg : bg,
67
- color: 'white',
68
- left: __position,
69
- width: __fill ? __width : (width ?? __width),
70
- height: height,
71
- border: '1px solid #555',
72
- borderRadius: '0 0 8px 8px',
73
- cursor: __disabled ? 'not-allowed' : 'pointer',
74
- zIndex: 2,
75
- ...style,
76
- })}
77
- onPointerDown={() => {
78
- if (__disabled) return
79
- setPlayed(true)
80
- if (__playNote) __playNote(__note!)
81
- }}
82
- onPointerEnter={() => {
83
- if (__disabled) return
84
- if (__glissando) {
70
+ return (
71
+ <div
72
+ className={clsx(`tremolo-piano-black-key`, className)}
73
+ aria-disabled={__disabled}
74
+ data-active={played}
75
+ style={{
76
+ left: __position,
77
+ width: __fill ? __width : (width ?? __width),
78
+ height: height,
79
+ ...style,
80
+ }}
81
+ onPointerDown={() => {
82
+ if (__disabled) return
85
83
  setPlayed(true)
86
84
  if (__playNote) __playNote(__note!)
87
- }
88
- }}
89
- onPointerUp={() => {
90
- if (__disabled) return
91
- setPlayed(false)
92
- if (__stopNote) __stopNote(__note!)
93
- }}
94
- onPointerLeave={() => {
95
- if (__disabled) return
96
- setPlayed(false)
97
- if (__stopNote) __stopNote(__note!)
98
- }}
99
- >
100
- <KeyLabel
101
- __note={__note}
102
- __label={__label}
103
- __index={__index}
104
- {...keyLabelProps}
105
- />
106
- </div>
107
- )
108
- })
85
+ }}
86
+ onPointerEnter={() => {
87
+ if (__disabled) return
88
+ if (__glissando) {
89
+ setPlayed(true)
90
+ if (__playNote) __playNote(__note!)
91
+ }
92
+ }}
93
+ onPointerUp={() => {
94
+ if (__disabled) return
95
+ setPlayed(false)
96
+ if (__stopNote) __stopNote(__note!)
97
+ }}
98
+ onPointerLeave={() => {
99
+ if (__disabled) return
100
+ setPlayed(false)
101
+ if (__stopNote) __stopNote(__note!)
102
+ }}
103
+ {...props}
104
+ >
105
+ <KeyLabel
106
+ __note={__note}
107
+ __label={__label}
108
+ __index={__index}
109
+ {...keyLabelProps}
110
+ />
111
+ </div>
112
+ )
113
+ },
114
+ )
@@ -1,16 +1,14 @@
1
- import { css, CSSObject } from "@emotion/react"
2
- import clsx from "clsx"
3
- import { ReactNode } from "react"
1
+ import clsx from 'clsx'
2
+ import { ComponentPropsWithoutRef, CSSProperties, ReactNode } from 'react'
4
3
 
5
- interface Props {
4
+ export interface KeyLabelProps {
6
5
  /**
7
6
  * override Piano.label
8
7
  */
9
8
  label?: (note: number, index: number) => ReactNode
10
9
 
11
- className?: string
12
- style?: CSSObject
13
- wrapperStyle?: CSSObject
10
+ wrapperClassName?: string
11
+ wrapperStyle?: CSSProperties
14
12
 
15
13
  /** @internal */
16
14
  __note?: number
@@ -23,47 +21,27 @@ interface Props {
23
21
  export function KeyLabel({
24
22
  label,
25
23
  className,
26
- style,
24
+ wrapperClassName,
27
25
  wrapperStyle,
28
26
  __note,
29
27
  __index,
30
28
  __label,
31
- }: Props) {
32
- const content = label ? label(__note!, __index!) : __label && __label(__note!, __index!)
29
+ ...props
30
+ }: KeyLabelProps & Omit<ComponentPropsWithoutRef<'div'>, keyof KeyLabelProps>) {
31
+ const content = label
32
+ ? label(__note!, __index!)
33
+ : __label && __label(__note!, __index!)
33
34
 
34
35
  return (
35
- (content != undefined || content != null) &&
36
- <div
37
- className='tremolo-piano-key-label-wrapper'
38
- css={css({
39
- display: 'flex',
40
- justifyContent: 'center',
41
- alignItems: 'end',
42
- height: '100%',
43
- ...wrapperStyle
44
- })}
45
- >
36
+ (content != undefined || content != null) && (
46
37
  <div
47
- className={clsx('tremolo-piano-key-label', className)}
48
- css={css({
49
- display: 'flex',
50
- justifyContent: 'center',
51
- alignItems: 'center',
52
- fontSize: '0.6rem',
53
- height: 10,
54
- marginBottom: 10,
55
- padding: 4,
56
- borderRadius: 4,
57
- borderStyle: 'solid',
58
- borderWidth: 1,
59
- borderColor: '#888',
60
- aspectRatio: 1,
61
- maxWidth: 'calc(100% - 16px)',
62
- ...style
63
- })}
38
+ className={clsx('tremolo-piano-key-label-wrapper', wrapperClassName)}
39
+ style={wrapperStyle}
64
40
  >
65
- {content}
41
+ <div className={clsx('tremolo-piano-key-label', className)} {...props}>
42
+ {content}
43
+ </div>
66
44
  </div>
67
- </div>
45
+ )
68
46
  )
69
47
  }
@@ -1,31 +1,41 @@
1
- import { css } from "@emotion/react"
2
- import React, { forwardRef, useImperativeHandle } from "react"
3
- import { useState } from "react"
4
- import { KeyLabel } from "./KeyLabel"
5
- import { KeyMethods, KeyProps } from "./key"
1
+ import clsx from 'clsx'
2
+ import React, {
3
+ ComponentPropsWithoutRef,
4
+ forwardRef,
5
+ useImperativeHandle,
6
+ useState,
7
+ } from 'react'
6
8
 
9
+ import { KeyMethods, KeyProps } from './key'
10
+ import { KeyLabel, KeyLabelProps } from './KeyLabel'
7
11
 
8
- export const WhiteKey = forwardRef<KeyMethods, KeyProps>(({
9
- width = 40,
10
- height = '100%',
11
- bg = 'white',
12
- activeBg = '#ccc',
13
- style,
14
- children,
15
- __glissando,
16
- __position,
17
- __note,
18
- __disabled,
19
- __index,
20
- __fill,
21
- __width,
22
- __playNote,
23
- __stopNote,
24
- __label,
25
- }: KeyProps, ref) => {
26
- const [played, setPlayed] = useState(false)
12
+ type Props = KeyProps & Omit<ComponentPropsWithoutRef<'div'>, keyof KeyProps>
27
13
 
28
- useImperativeHandle(ref, () => {
14
+ export const WhiteKey = forwardRef<KeyMethods, Props>(
15
+ (
16
+ {
17
+ width = 40,
18
+ height = '100%',
19
+ className,
20
+ style,
21
+ children,
22
+ __glissando,
23
+ __position,
24
+ __note,
25
+ __disabled,
26
+ __index,
27
+ __fill,
28
+ __width,
29
+ __playNote,
30
+ __stopNote,
31
+ __label,
32
+ ...props
33
+ }: Props,
34
+ ref,
35
+ ) => {
36
+ const [played, setPlayed] = useState(false)
37
+
38
+ useImperativeHandle(ref, () => {
29
39
  return {
30
40
  play() {
31
41
  if (__disabled) return
@@ -38,72 +48,67 @@ export const WhiteKey = forwardRef<KeyMethods, KeyProps>(({
38
48
  },
39
49
  played() {
40
50
  return played
41
- }
51
+ },
42
52
  }
43
- }, [])
53
+ }, [__disabled, __note, __playNote, __stopNote, played])
44
54
 
45
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
- let keyLabelProps: any
47
- if (children != undefined) {
48
- React.Children.forEach(children, (child) => {
49
- if (React.isValidElement(child)) {
50
- if (child.type == KeyLabel) {
51
- keyLabelProps = child.props
55
+ let keyLabelProps: KeyLabelProps = {}
56
+ if (children != undefined) {
57
+ React.Children.forEach(children, (child) => {
58
+ if (React.isValidElement(child)) {
59
+ if (child.type == KeyLabel) {
60
+ keyLabelProps = child.props as KeyLabelProps
61
+ } else {
62
+ throw new Error('only <KeyLabel>')
63
+ }
52
64
  } else {
53
- throw new Error('only <KeyLabel>')
65
+ throw new Error('children is an invalid element.')
54
66
  }
55
- } else {
56
- throw new Error('children is an invalid element.')
57
- }
58
- })
59
- }
67
+ })
68
+ }
60
69
 
61
- return (
62
- <div
63
- className={`tremolo-piano-white-key`}
64
- aria-disabled={__disabled}
65
- css={css({
66
- position: 'absolute',
67
- backgroundColor: played ? activeBg : bg,
68
- color: 'black',
69
- left: __position,
70
- width: __fill ? __width : (width ?? __width),
71
- height: height,
72
- border: '1px solid #555',
73
- borderRadius: '0 0 8px 8px',
74
- cursor: __disabled ? 'not-allowed' : 'pointer',
75
- zIndex: 1,
76
- ...style,
77
- })}
78
- onPointerDown={() => {
79
- if (__disabled) return
80
- setPlayed(true)
81
- if (__playNote) __playNote(__note!)
82
- }}
83
- onPointerEnter={() => {
84
- if (__disabled) return
85
- if (__glissando) {
70
+ return (
71
+ <div
72
+ className={clsx(`tremolo-piano-white-key`, className)}
73
+ aria-disabled={__disabled}
74
+ data-active={played}
75
+ style={{
76
+ left: __position,
77
+ width: __fill ? __width : (width ?? __width),
78
+ height: height,
79
+ ...style,
80
+ }}
81
+ onPointerDown={() => {
82
+ if (__disabled) return
86
83
  setPlayed(true)
87
84
  if (__playNote) __playNote(__note!)
88
- }
89
- }}
90
- onPointerUp={() => {
91
- if (__disabled) return
92
- setPlayed(false)
93
- if (__stopNote) __stopNote(__note!)
94
- }}
95
- onPointerLeave={() => {
96
- if (__disabled) return
97
- setPlayed(false)
98
- if (__stopNote) __stopNote(__note!)
99
- }}
100
- >
101
- <KeyLabel
102
- __note={__note}
103
- __label={__label}
104
- __index={__index}
105
- {...keyLabelProps}
106
- />
107
- </div>
108
- )
109
- })
85
+ }}
86
+ onPointerEnter={() => {
87
+ if (__disabled) return
88
+ if (__glissando) {
89
+ setPlayed(true)
90
+ if (__playNote) __playNote(__note!)
91
+ }
92
+ }}
93
+ onPointerUp={() => {
94
+ if (__disabled) return
95
+ setPlayed(false)
96
+ if (__stopNote) __stopNote(__note!)
97
+ }}
98
+ onPointerLeave={() => {
99
+ if (__disabled) return
100
+ setPlayed(false)
101
+ if (__stopNote) __stopNote(__note!)
102
+ }}
103
+ {...props}
104
+ >
105
+ <KeyLabel
106
+ __note={__note}
107
+ __label={__label}
108
+ __index={__index}
109
+ {...keyLabelProps}
110
+ />
111
+ </div>
112
+ )
113
+ },
114
+ )
@@ -0,0 +1,63 @@
1
+ .tremolo-piano {
2
+ display: inline-block;
3
+ box-sizing: border-box;
4
+ user-select: none;
5
+ position: relative;
6
+ }
7
+
8
+ .tremolo-piano-white-key {
9
+ position: absolute;
10
+ background-color: white;
11
+ color: black;
12
+ border: 1px solid #555;
13
+ border-radius: 0px 0px 8px 8px;
14
+ cursor: pointer;
15
+ z-index: 1;
16
+
17
+ &[data-active='true'] {
18
+ background-color: #ccc;
19
+ }
20
+
21
+ &[aria-disabled='true'] {
22
+ cursor: not-allowed;
23
+ }
24
+ }
25
+
26
+ .tremolo-piano-black-key {
27
+ position: absolute;
28
+ background-color: #333;
29
+ color: white;
30
+ border: 1px solid #555;
31
+ border-radius: 0px 0px 8px 8px;
32
+ cursor: pointer;
33
+ z-index: 2;
34
+
35
+ &[data-active='true'] {
36
+ background-color: #666;
37
+ }
38
+
39
+ &[aria-disabled='true'] {
40
+ cursor: not-allowed;
41
+ }
42
+ }
43
+
44
+ .tremolo-piano-key-label-wrapper {
45
+ display: flex;
46
+ justify-content: center;
47
+ align-items: end;
48
+ height: 100%;
49
+ }
50
+
51
+ .tremolo-piano-key-label {
52
+ display: flex;
53
+ justify-content: center;
54
+ align-items: center;
55
+ font-size: 0.6rem;
56
+ height: 10px;
57
+ margin-bottom: 10px;
58
+ padding: 4px;
59
+ border-radius: 4px;
60
+ border: 1px solid #888;
61
+ aspect-ratio: 1;
62
+ max-width: calc(100% - 16px);
63
+ }