@gaulatti/bleecker 0.1.46 → 0.1.48
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.
- package/dist/components/arm-take.d.ts +17 -0
- package/dist/components/arm-take.js +93 -0
- package/dist/components/drawer.d.ts +20 -3
- package/dist/components/drawer.js +14 -2
- package/dist/components/fader.d.ts +35 -0
- package/dist/components/fader.js +125 -0
- package/dist/components/key-cap.d.ts +7 -0
- package/dist/components/key-cap.js +10 -0
- package/dist/components/meter.d.ts +21 -0
- package/dist/components/meter.js +15 -0
- package/dist/components/on-air-strip.d.ts +35 -0
- package/dist/components/on-air-strip.js +16 -0
- package/dist/components/segmented-filter.d.ts +19 -0
- package/dist/components/segmented-filter.js +13 -0
- package/dist/components/state-pill.d.ts +16 -0
- package/dist/components/state-pill.js +19 -0
- package/dist/components/table.d.ts +15 -1
- package/dist/components/table.js +21 -3
- package/dist/components/toggle-group.js +14 -2
- package/dist/components/transport.d.ts +29 -0
- package/dist/components/transport.js +59 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/styles.css +1 -1
- package/dist/tokens/source.d.ts +54 -0
- package/dist/tokens/source.js +45 -2
- package/package.json +3 -2
- package/src/styles/tokens.generated.css +36 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface TransportCue {
|
|
2
|
+
/** Where the cue sits, in seconds. */
|
|
3
|
+
at: number;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TransportProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Marks on the timeline, such as a song's cue in and cue out. */
|
|
9
|
+
cues?: TransportCue[];
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Seconds, or null when the length is unknown (the timeline is then hidden). */
|
|
12
|
+
duration: number | null;
|
|
13
|
+
onNext?: () => void;
|
|
14
|
+
onPrev?: () => void;
|
|
15
|
+
/** Called with the new position in seconds. Without it the timeline is read only. */
|
|
16
|
+
onSeek?: (seconds: number) => void;
|
|
17
|
+
onToggle: () => void;
|
|
18
|
+
playing: boolean;
|
|
19
|
+
/** Seconds. */
|
|
20
|
+
position: number;
|
|
21
|
+
subtitle?: string;
|
|
22
|
+
title: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One shared transport for a list of audio: previous, play or pause, next, what is loaded, a
|
|
26
|
+
* timeline with cue marks, and the time. It is presentational: the page owns the audio element.
|
|
27
|
+
* Space toggles on the timeline, and the arrow keys seek by five seconds.
|
|
28
|
+
*/
|
|
29
|
+
export declare function Transport({ className, cues, disabled, duration, onNext, onPrev, onSeek, onToggle, playing, position, subtitle, title }: TransportProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pause, Play, SkipBack, SkipForward } from 'lucide-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { cn } from '../utils/cn.js';
|
|
5
|
+
const SEEK_STEP_SECONDS = 5;
|
|
6
|
+
function formatClock(seconds) {
|
|
7
|
+
if (seconds === null || !Number.isFinite(seconds))
|
|
8
|
+
return '—';
|
|
9
|
+
const whole = Math.max(0, Math.floor(seconds));
|
|
10
|
+
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, '0')}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One shared transport for a list of audio: previous, play or pause, next, what is loaded, a
|
|
14
|
+
* timeline with cue marks, and the time. It is presentational: the page owns the audio element.
|
|
15
|
+
* Space toggles on the timeline, and the arrow keys seek by five seconds.
|
|
16
|
+
*/
|
|
17
|
+
export function Transport({ className, cues = [], disabled = false, duration, onNext, onPrev, onSeek, onToggle, playing, position, subtitle, title }) {
|
|
18
|
+
const timeline = React.useRef(null);
|
|
19
|
+
const length = duration !== null && duration > 0 ? duration : null;
|
|
20
|
+
const clamped = length === null ? Math.max(0, position) : Math.min(Math.max(0, position), length);
|
|
21
|
+
const percent = (seconds, total) => Math.max(0, Math.min(100, (seconds / total) * 100));
|
|
22
|
+
const seekTo = (seconds) => {
|
|
23
|
+
if (!onSeek || length === null)
|
|
24
|
+
return;
|
|
25
|
+
onSeek(Math.max(0, Math.min(length, seconds)));
|
|
26
|
+
};
|
|
27
|
+
const onKeyDown = (event) => {
|
|
28
|
+
if (disabled)
|
|
29
|
+
return;
|
|
30
|
+
if (event.key === ' ') {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
onToggle();
|
|
33
|
+
}
|
|
34
|
+
else if (event.key === 'ArrowRight') {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
seekTo(clamped + SEEK_STEP_SECONDS);
|
|
37
|
+
}
|
|
38
|
+
else if (event.key === 'ArrowLeft') {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
seekTo(clamped - SEEK_STEP_SECONDS);
|
|
41
|
+
}
|
|
42
|
+
else if (event.key === 'Home') {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
seekTo(0);
|
|
45
|
+
}
|
|
46
|
+
else if (event.key === 'End' && length !== null) {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
seekTo(length);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const buttonClass = 'inline-flex h-8 w-8 items-center justify-center rounded-full text-text-secondary hover:bg-sand/20 hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-sea disabled:pointer-events-none disabled:opacity-40 dark:focus-visible:ring-accent-blue';
|
|
52
|
+
return (_jsxs("div", { role: 'group', "aria-label": 'Transport', className: cn('flex items-center gap-4 rounded-[var(--radius-card)] border border-sand/30 bg-light-sand/50 px-4 py-2.5 dark:border-white/10 dark:bg-white/[0.04]', className), children: [_jsxs("div", { className: 'flex items-center gap-1', children: [_jsx("button", { type: 'button', "aria-label": 'Previous', className: buttonClass, disabled: disabled || !onPrev, onClick: onPrev, children: _jsx(SkipBack, { size: 14, "aria-hidden": 'true' }) }), _jsx("button", { type: 'button', "aria-label": playing ? 'Pause' : 'Play', className: 'inline-flex h-9 w-9 items-center justify-center rounded-full bg-sea text-white hover:bg-deep-sea focus:outline-none focus-visible:ring-2 focus-visible:ring-sea focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-40 dark:bg-accent-blue dark:hover:bg-accent-blue/80 dark:focus-visible:ring-accent-blue', disabled: disabled, onClick: onToggle, children: playing ? _jsx(Pause, { size: 16, "aria-hidden": 'true' }) : _jsx(Play, { size: 16, "aria-hidden": 'true' }) }), _jsx("button", { type: 'button', "aria-label": 'Next', className: buttonClass, disabled: disabled || !onNext, onClick: onNext, children: _jsx(SkipForward, { size: 14, "aria-hidden": 'true' }) })] }), _jsxs("div", { className: 'min-w-0 basis-40', children: [_jsx("p", { className: 'truncate text-sm font-semibold text-text-primary', children: title }), subtitle ? _jsx("p", { className: 'truncate text-[11px] text-text-secondary', children: subtitle }) : null] }), length !== null ? (_jsxs("div", { ref: timeline, role: 'slider', tabIndex: disabled ? -1 : 0, "aria-label": 'Position', "aria-valuemin": 0, "aria-valuemax": Math.round(length), "aria-valuenow": Math.round(clamped), "aria-valuetext": `${formatClock(clamped)} of ${formatClock(length)}`, "aria-disabled": disabled || !onSeek, onKeyDown: onKeyDown, onClick: (event) => {
|
|
53
|
+
if (!onSeek || disabled || !timeline.current)
|
|
54
|
+
return;
|
|
55
|
+
const box = timeline.current.getBoundingClientRect();
|
|
56
|
+
if (box.width > 0)
|
|
57
|
+
seekTo(((event.clientX - box.left) / box.width) * length);
|
|
58
|
+
}, className: 'relative h-4 min-w-24 flex-1 cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-sea dark:focus-visible:ring-accent-blue', children: [_jsx("span", { className: 'absolute inset-x-0 top-1/2 h-[3px] -translate-y-1/2 rounded-full bg-sand/50 dark:bg-sand/40' }), _jsx("span", { "data-transport": 'done', className: 'absolute left-0 top-1/2 h-[3px] -translate-y-1/2 rounded-full bg-sea dark:bg-accent-blue', style: { width: `${percent(clamped, length)}%` } }), cues.map((cue) => (_jsx("span", { "data-transport": 'cue', title: cue.label, className: 'absolute top-0 h-full w-0.5 bg-accent-text dark:bg-accent-yellow', style: { left: `${percent(cue.at, length)}%` } }, `${cue.label}-${cue.at}`)))] })) : (_jsx("div", { className: 'flex-1' })), _jsxs("p", { className: 'shrink-0 font-mono text-xs tabular-nums text-text-secondary', children: [_jsx("b", { className: 'text-text-primary', children: formatClock(clamped) }), " / ", formatClock(length)] })] }));
|
|
59
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from './components/eyebrow';
|
|
|
57
57
|
export * from './components/hover-card';
|
|
58
58
|
export * from './components/input';
|
|
59
59
|
export * from './components/kbd';
|
|
60
|
+
export * from './components/key-cap';
|
|
60
61
|
export * from './components/label';
|
|
61
62
|
export * from './components/menubar';
|
|
62
63
|
export * from './components/navigation-menu';
|
|
@@ -95,7 +96,14 @@ export * from './components/file-input';
|
|
|
95
96
|
export * from './components/section-header';
|
|
96
97
|
export * from './assets/logo';
|
|
97
98
|
export * from './components/panel';
|
|
99
|
+
export * from './components/arm-take';
|
|
100
|
+
export * from './components/meter';
|
|
101
|
+
export * from './components/fader';
|
|
102
|
+
export * from './components/on-air-strip';
|
|
103
|
+
export * from './components/segmented-filter';
|
|
104
|
+
export * from './components/transport';
|
|
98
105
|
export * from './components/status-badge';
|
|
106
|
+
export * from './components/state-pill';
|
|
99
107
|
export * from './components/table';
|
|
100
108
|
export { DataTable as TanStackDataTable } from './components/data-table';
|
|
101
109
|
export * from './components/tabs';
|
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ export * from './components/eyebrow.js';
|
|
|
57
57
|
export * from './components/hover-card.js';
|
|
58
58
|
export * from './components/input.js';
|
|
59
59
|
export * from './components/kbd.js';
|
|
60
|
+
export * from './components/key-cap.js';
|
|
60
61
|
export * from './components/label.js';
|
|
61
62
|
export * from './components/menubar.js';
|
|
62
63
|
export * from './components/navigation-menu.js';
|
|
@@ -95,7 +96,14 @@ export * from './components/file-input.js';
|
|
|
95
96
|
export * from './components/section-header.js';
|
|
96
97
|
export * from './assets/logo.js';
|
|
97
98
|
export * from './components/panel.js';
|
|
99
|
+
export * from './components/arm-take.js';
|
|
100
|
+
export * from './components/meter.js';
|
|
101
|
+
export * from './components/fader.js';
|
|
102
|
+
export * from './components/on-air-strip.js';
|
|
103
|
+
export * from './components/segmented-filter.js';
|
|
104
|
+
export * from './components/transport.js';
|
|
98
105
|
export * from './components/status-badge.js';
|
|
106
|
+
export * from './components/state-pill.js';
|
|
99
107
|
export * from './components/table.js';
|
|
100
108
|
export { DataTable as TanStackDataTable } from './components/data-table.js';
|
|
101
109
|
export * from './components/tabs.js';
|