Skip to content

Commit 3f164e9

Browse files
arraypressclaude
andcommitted
feat: barRadius + gradient color props (mirror core 1.8.0)
Adds the barRadius prop (rounded bar caps) and allows waveformColor/ progressColor to be an array of gradient stops, matching the core @arraypress/waveform-player 1.8.0 additions. Astro path JSON-encodes array colors into the data-attribute; React passes them through. Not yet released — peer bump to ^1.8.0 + version bump will land with the next wrapper release once core 1.8.0 is published. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 71fb7a6 commit 3f164e9

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/WaveformPlayer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function buildLibraryOptions(props: WaveformPlayerProps): Record<string, unknown
8181
if (props.samples !== undefined) opts.samples = props.samples;
8282
if (props.barWidth !== undefined) opts.barWidth = props.barWidth;
8383
if (props.barSpacing !== undefined) opts.barSpacing = props.barSpacing;
84+
if (props.barRadius !== undefined) opts.barRadius = props.barRadius;
8485
if (props.waveform !== undefined && props.waveform !== null) {
8586
opts.waveform = props.waveform;
8687
}
@@ -235,6 +236,7 @@ export const WaveformPlayer = forwardRef<WaveformPlayerHandle, WaveformPlayerPro
235236
props.samples,
236237
props.barWidth,
237238
props.barSpacing,
239+
props.barRadius,
238240
props.waveform,
239241
props.colorPreset,
240242
props.waveformColor,

src/types.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,19 @@ export interface WaveformPlayerProps {
183183
barWidth?: number;
184184
/** Gap between bars in pixels. */
185185
barSpacing?: number;
186+
/** Rounded bar-cap radius in pixels (bars/mirror). `0` = square. @default 0 */
187+
barRadius?: number;
186188
/** Pre-computed peaks data. See {@link WaveformPeaks}. */
187189
waveform?: WaveformPeaks;
188190

189191
// ── 3. Colours ─────────────────────────────────────────────────────
190192

191193
/** Forced colour preset; `null` auto-detects. @default null */
192194
colorPreset?: ColorPreset;
193-
/** Unplayed peak colour (CSS colour string). */
194-
waveformColor?: string;
195-
/** Progress/played-through colour. */
196-
progressColor?: string;
195+
/** Unplayed peak colour. A CSS colour string, or an array of stops for a vertical gradient (e.g. `['#fafafa', '#71717a']`). */
196+
waveformColor?: string | string[];
197+
/** Progress/played-through colour. Also accepts an array of stops for a gradient. */
198+
progressColor?: string | string[];
197199
/** Play button border/text colour. */
198200
buttonColor?: string;
199201
/** Play button hover colour. */

0 commit comments

Comments
 (0)