@hussmartinez/ui 0.10.0 → 0.12.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.
- package/README.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +507 -0
- package/dist/react.js +1036 -28
- package/dist/react.js.map +1 -1
- package/dist/styles.css +350 -0
- package/dist/ui.d.ts +507 -0
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -1455,6 +1455,490 @@ export declare interface ThemeProviderSingleProps extends ThemeProviderBaseProps
|
|
|
1455
1455
|
readonly mode?: undefined;
|
|
1456
1456
|
}
|
|
1457
1457
|
|
|
1458
|
+
/**
|
|
1459
|
+
* A timeline over whole units, such as frames or samples: a scrolling track
|
|
1460
|
+
* as wide as `length` at the current zoom, for a playhead, clips and an
|
|
1461
|
+
* editor's own layers (docs/adr/0011). It formats no time and has no text
|
|
1462
|
+
* of its own: names and values come from you.
|
|
1463
|
+
*
|
|
1464
|
+
* - **Zoom** is yours: `zoom` is a multiple of fitting `length` to the
|
|
1465
|
+
* width, and `onMaxZoomChange` says where it stops.
|
|
1466
|
+
* - **Snapping** pulls a pointer to the playhead, the clips' boundaries and
|
|
1467
|
+
* your `snapTargets`, within 8 CSS pixels at any zoom.
|
|
1468
|
+
* - **Layers** are your own drawing, such as a waveform, sized to the
|
|
1469
|
+
* track. `useTimelineScale()` gives them the same mapping the parts use.
|
|
1470
|
+
*
|
|
1471
|
+
* @example
|
|
1472
|
+
* ```tsx
|
|
1473
|
+
* <Timeline label={t("timeline.label")} length={frames} zoom={zoom} onMaxZoomChange={setMaxZoom}>
|
|
1474
|
+
* <TimelineLayer>
|
|
1475
|
+
* <Waveform />
|
|
1476
|
+
* </TimelineLayer>
|
|
1477
|
+
* <TimelinePlayhead
|
|
1478
|
+
* label={t("timeline.playhead")}
|
|
1479
|
+
* position={playhead}
|
|
1480
|
+
* onPositionChange={seek}
|
|
1481
|
+
* largeStep={framesPerSecond}
|
|
1482
|
+
* formatValue={formatTime}
|
|
1483
|
+
* />
|
|
1484
|
+
* </Timeline>
|
|
1485
|
+
* ```
|
|
1486
|
+
*
|
|
1487
|
+
* @public
|
|
1488
|
+
*/
|
|
1489
|
+
export declare const Timeline: ForwardRefExoticComponent<TimelineProps & RefAttributes<HTMLElement>>;
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* A clip on a {@link TimelineClips} track.
|
|
1493
|
+
*
|
|
1494
|
+
* @public
|
|
1495
|
+
*/
|
|
1496
|
+
export declare interface TimelineClip {
|
|
1497
|
+
/** Identifies the clip in `selectedKeys`. Unique on the track. */
|
|
1498
|
+
readonly key: string;
|
|
1499
|
+
/** The clip's length, in the timeline's units: a whole number, at least 1. */
|
|
1500
|
+
readonly length: number;
|
|
1501
|
+
/**
|
|
1502
|
+
* The unit the clip starts on, for a track with room between its clips.
|
|
1503
|
+
* Give it to every clip of the track, in time order and without overlap,
|
|
1504
|
+
* or to none: without it, each clip starts where the one before ends.
|
|
1505
|
+
*/
|
|
1506
|
+
readonly at?: number | undefined;
|
|
1507
|
+
/**
|
|
1508
|
+
* The clip's accessible name, with its place and range, such as
|
|
1509
|
+
* "Clip 2 of 5, 0:04.00 to 0:09.20, muted". Use text from your message
|
|
1510
|
+
* catalogue. When `content` shows text, start the name with that text, so
|
|
1511
|
+
* what's seen is in what's heard (WCAG 2.5.3).
|
|
1512
|
+
*/
|
|
1513
|
+
readonly label: string;
|
|
1514
|
+
/** What the clip shows, such as its name or a thumbnail. It's cut off where the clip ends. */
|
|
1515
|
+
readonly content?: ReactNode;
|
|
1516
|
+
/** `data-*` attributes for the clip, for your own states, such as `data-muted`. */
|
|
1517
|
+
readonly attributes?: Readonly<Record<`data-${string}`, string | undefined>> | undefined;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Where a dragged clip was dropped.
|
|
1522
|
+
*
|
|
1523
|
+
* @public
|
|
1524
|
+
*/
|
|
1525
|
+
export declare interface TimelineClipDrop {
|
|
1526
|
+
/** How far along time, in units: negative for earlier. */
|
|
1527
|
+
readonly by: number;
|
|
1528
|
+
/** The `id` of the lane it's over, when that isn't the lane it came from. */
|
|
1529
|
+
readonly lane?: string | undefined;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
/**
|
|
1533
|
+
* A clip's edge: its start, or its end.
|
|
1534
|
+
*
|
|
1535
|
+
* @public
|
|
1536
|
+
*/
|
|
1537
|
+
export declare type TimelineClipEdge = "start" | "end";
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* The clip track of a {@link Timeline}: a horizontal listbox with one Tab
|
|
1541
|
+
* stop, each clip as wide as its length at the timeline's zoom
|
|
1542
|
+
* (docs/adr/0011).
|
|
1543
|
+
*
|
|
1544
|
+
* - **← and →** move between clips, and Home and End go to the first and
|
|
1545
|
+
* last. They follow the reading direction. The selection follows focus.
|
|
1546
|
+
* - **With `selectionMode="multiple"`,** Shift extends the selection from
|
|
1547
|
+
* the last clip chosen; Ctrl or ⌘ moves focus without changing it; Space
|
|
1548
|
+
* adds or removes the focused clip, and Shift+Space selects up to it;
|
|
1549
|
+
* Ctrl or ⌘+A selects every clip. A click selects, a Shift-click
|
|
1550
|
+
* extends, and a Ctrl- or ⌘-click adds or removes.
|
|
1551
|
+
* - **Clips are data.** Give each a `label` that says its place and range,
|
|
1552
|
+
* since a screen reader can't see where it is on the track.
|
|
1553
|
+
* - **When the focused clip goes,** focus moves to the clip that took its
|
|
1554
|
+
* place, or the one before, or the playhead, if focus was on the track.
|
|
1555
|
+
*
|
|
1556
|
+
* The clips' boundaries are snap targets for the rest of the timeline.
|
|
1557
|
+
*
|
|
1558
|
+
* @example
|
|
1559
|
+
* ```tsx
|
|
1560
|
+
* <TimelineClips
|
|
1561
|
+
* label={t("timeline.clips")}
|
|
1562
|
+
* selectionMode="multiple"
|
|
1563
|
+
* clips={plan.clips.map((clip, index) => ({
|
|
1564
|
+
* key: clip.key,
|
|
1565
|
+
* length: framesOf(clip),
|
|
1566
|
+
* label: t("timeline.clip", { index: index + 1, count: plan.clips.length, … }),
|
|
1567
|
+
* content: clip.name,
|
|
1568
|
+
* }))}
|
|
1569
|
+
* selectedKeys={selected}
|
|
1570
|
+
* onSelectedKeysChange={setSelected}
|
|
1571
|
+
* />
|
|
1572
|
+
* ```
|
|
1573
|
+
*
|
|
1574
|
+
* @public
|
|
1575
|
+
*/
|
|
1576
|
+
export declare const TimelineClips: ForwardRefExoticComponent<TimelineClipsProps & RefAttributes<TimelineClipsHandle>>;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* What a {@link TimelineClips} ref gives.
|
|
1580
|
+
*
|
|
1581
|
+
* @public
|
|
1582
|
+
*/
|
|
1583
|
+
export declare interface TimelineClipsHandle {
|
|
1584
|
+
/** Moves focus to a clip, and scrolls it into view. Returns whether it's on the track. */
|
|
1585
|
+
focusClip(key: string): boolean;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* The parts of a clip track that `classNames` can target.
|
|
1590
|
+
*
|
|
1591
|
+
* @public
|
|
1592
|
+
*/
|
|
1593
|
+
export declare type TimelineClipsPart = "root" | "clip" | "content";
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Props of {@link TimelineClips}.
|
|
1597
|
+
*
|
|
1598
|
+
* @public
|
|
1599
|
+
*/
|
|
1600
|
+
export declare interface TimelineClipsProps extends StyleProps<TimelineClipsPart> {
|
|
1601
|
+
/** The track's accessible name, such as "Clips". Required. */
|
|
1602
|
+
readonly label: string;
|
|
1603
|
+
/** The clips, in the order they play. */
|
|
1604
|
+
readonly clips: readonly TimelineClip[];
|
|
1605
|
+
/**
|
|
1606
|
+
* `single`, the default, keeps one clip selected: the focused one.
|
|
1607
|
+
* `multiple` adds Shift to extend the selection, Ctrl or ⌘ to move
|
|
1608
|
+
* without changing it, and Space to add or remove the focused clip.
|
|
1609
|
+
*/
|
|
1610
|
+
readonly selectionMode?: "single" | "multiple" | undefined;
|
|
1611
|
+
/** The selected clips' keys. */
|
|
1612
|
+
readonly selectedKeys: readonly string[];
|
|
1613
|
+
/** Called with the new selection, in the clips' order. */
|
|
1614
|
+
readonly onSelectedKeysChange: (keys: readonly string[]) => void;
|
|
1615
|
+
/**
|
|
1616
|
+
* Called when the user moves clips with Alt+← or Alt+→ (Option on macOS),
|
|
1617
|
+
* with the keys to move, in order, and `-1` for earlier or `1` for later.
|
|
1618
|
+
* They're the selected clips when the focused one is selected, and the
|
|
1619
|
+
* focused clip otherwise. Render the clips in the new order, or leave them
|
|
1620
|
+
* when the move isn't allowed. The keys are taken at the first and last
|
|
1621
|
+
* clips too, and without `onMove`, so the browser never goes back instead.
|
|
1622
|
+
*/
|
|
1623
|
+
readonly onMove?: ((keys: readonly string[], direction: -1 | 1) => void) | undefined;
|
|
1624
|
+
/**
|
|
1625
|
+
* Called when the user changes a clip's length at one edge, by dragging
|
|
1626
|
+
* the edge or with Alt+`[` and Alt+`]`, with the change in units:
|
|
1627
|
+
* positive makes the clip longer at that edge, negative shorter. A drag
|
|
1628
|
+
* calls it once, when it ends. With it, each clip has edges to drag.
|
|
1629
|
+
*/
|
|
1630
|
+
readonly onTrim?: ((key: string, edge: TimelineClipEdge, delta: number) => void) | undefined;
|
|
1631
|
+
/**
|
|
1632
|
+
* Called for `[` and `]` on a focused clip: set its start or its end to
|
|
1633
|
+
* the playhead. You know where the playhead is.
|
|
1634
|
+
*/
|
|
1635
|
+
readonly onTrimToPlayhead?: ((key: string, edge: TimelineClipEdge) => void) | undefined;
|
|
1636
|
+
/** What Alt+`[` and Alt+`]` change an edge by, in units. Defaults to 1. */
|
|
1637
|
+
readonly trimStep?: number | undefined;
|
|
1638
|
+
/**
|
|
1639
|
+
* How far an edge can go, as `onTrim`'s `delta`, such as up to its
|
|
1640
|
+
* source's end. A drag stops there. Without it, a clip can shrink to one
|
|
1641
|
+
* unit and grow without limit.
|
|
1642
|
+
*/
|
|
1643
|
+
readonly trimLimits?: ((key: string, edge: TimelineClipEdge) => {
|
|
1644
|
+
readonly min?: number;
|
|
1645
|
+
readonly max?: number;
|
|
1646
|
+
}) | undefined;
|
|
1647
|
+
/**
|
|
1648
|
+
* Called when the user moves clips to the lane above (`-1`) or below
|
|
1649
|
+
* (`1`) with Alt+↑ or Alt+↓ (Option on macOS), with the same keys as
|
|
1650
|
+
* `onMove`. Render them on that lane, at the same time, or leave them when
|
|
1651
|
+
* they can't go there. In a lane, the keys are taken with or without it,
|
|
1652
|
+
* so the page never scrolls instead.
|
|
1653
|
+
*/
|
|
1654
|
+
readonly onMoveLane?: ((keys: readonly string[], direction: -1 | 1) => void) | undefined;
|
|
1655
|
+
/**
|
|
1656
|
+
* Called once, when the user lets go of a clip dragged along time or to
|
|
1657
|
+
* another lane, with the keys that moved and where: `by` units, and the
|
|
1658
|
+
* `lane` it's over when that's another one. Render the clips there. With
|
|
1659
|
+
* it, a clip can be dragged, with a mouse or a pen; on a touch screen a
|
|
1660
|
+
* drag scrolls, and clips move with your buttons.
|
|
1661
|
+
*/
|
|
1662
|
+
readonly onDrop?: ((keys: readonly string[], drop: TimelineClipDrop) => void) | undefined;
|
|
1663
|
+
/**
|
|
1664
|
+
* Asked as a clip is dragged: whether it may be dropped there. Where it
|
|
1665
|
+
* may not, the clip shows it and letting go reports nothing: a place where
|
|
1666
|
+
* it would overlap another clip, or a lane that doesn't take it.
|
|
1667
|
+
*/
|
|
1668
|
+
readonly canDrop?: ((keys: readonly string[], drop: TimelineClipDrop) => boolean) | undefined;
|
|
1669
|
+
/**
|
|
1670
|
+
* What a drag takes hold of: the whole `clip`, the default, or only its
|
|
1671
|
+
* `title`, the strip that shows its `content`. With `title`, a press on
|
|
1672
|
+
* the rest of the clip passes to the layer under it, for an editor where
|
|
1673
|
+
* dragging across a track selects a range of time.
|
|
1674
|
+
*/
|
|
1675
|
+
readonly moveHandle?: "clip" | "title" | undefined;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* A lane of a {@link Timeline}: a track of an editor, with its own layers
|
|
1680
|
+
* and clip track, and a header that stays in view (docs/adr/0011). Lanes
|
|
1681
|
+
* stack downward in the order written, under one playhead.
|
|
1682
|
+
*
|
|
1683
|
+
* - **It's a group,** named by `label`, holding its header and its clips.
|
|
1684
|
+
* - **The header is a toolbar:** one Tab stop a lane, before its clips. The
|
|
1685
|
+
* headers share a column as wide as the widest. Where the timeline is
|
|
1686
|
+
* narrower than 720 pixels, each sits above its lane instead.
|
|
1687
|
+
* - **↑ and ↓ on a clip** go to the clip nearest in time on the next lane
|
|
1688
|
+
* that has clips, so nobody tabs through every lane.
|
|
1689
|
+
* - **You own the lanes' order:** move one by rendering it elsewhere.
|
|
1690
|
+
*
|
|
1691
|
+
* A timeline without lanes is one lane with no header, and needs none.
|
|
1692
|
+
*
|
|
1693
|
+
* @example
|
|
1694
|
+
* ```tsx
|
|
1695
|
+
* <Timeline label={t("timeline.label")} length={frames}>
|
|
1696
|
+
* <TimelinePlayhead … />
|
|
1697
|
+
* {tracks.map((track) => (
|
|
1698
|
+
* <TimelineLane
|
|
1699
|
+
* key={track.key}
|
|
1700
|
+
* id={track.key}
|
|
1701
|
+
* label={t("track.label", track)}
|
|
1702
|
+
* header={<TrackControls track={track} />}
|
|
1703
|
+
* >
|
|
1704
|
+
* <TimelineLayer><Waveform track={track} /></TimelineLayer>
|
|
1705
|
+
* <TimelineClips label={t("track.clips", track)} clips={…} … />
|
|
1706
|
+
* </TimelineLane>
|
|
1707
|
+
* ))}
|
|
1708
|
+
* </Timeline>
|
|
1709
|
+
* ```
|
|
1710
|
+
*
|
|
1711
|
+
* @public
|
|
1712
|
+
*/
|
|
1713
|
+
export declare const TimelineLane: ForwardRefExoticComponent<TimelineLaneProps & RefAttributes<HTMLDivElement>>;
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* The parts of a timeline's lane that `classNames` can target.
|
|
1717
|
+
*
|
|
1718
|
+
* @public
|
|
1719
|
+
*/
|
|
1720
|
+
export declare type TimelineLanePart = "root" | "header";
|
|
1721
|
+
|
|
1722
|
+
/**
|
|
1723
|
+
* Props of {@link TimelineLane}.
|
|
1724
|
+
*
|
|
1725
|
+
* @public
|
|
1726
|
+
*/
|
|
1727
|
+
export declare interface TimelineLaneProps extends Omit<HTMLAttributes<HTMLDivElement>, "className" | "role" | "id">, StyleProps<TimelineLanePart> {
|
|
1728
|
+
/** Identifies the lane: in `useTimelineLanes`, and when a clip moves between lanes. Unique in the timeline. */
|
|
1729
|
+
readonly id: string;
|
|
1730
|
+
/**
|
|
1731
|
+
* The lane's accessible name, with what a user needs to tell it from the
|
|
1732
|
+
* others, such as "Track 2, Music, muted". It names the lane's header too.
|
|
1733
|
+
*/
|
|
1734
|
+
readonly label: string;
|
|
1735
|
+
/**
|
|
1736
|
+
* The lane's controls, such as its name, Mute and Solo toggles and a gain
|
|
1737
|
+
* slider, last. The lane renders them in a toolbar that stays in view
|
|
1738
|
+
* while the timeline scrolls: one Tab stop, with ← and → between them.
|
|
1739
|
+
*/
|
|
1740
|
+
readonly header?: ReactNode;
|
|
1741
|
+
/** The lane's own layers and its clip track, stacked in the order written. */
|
|
1742
|
+
readonly children?: ReactNode;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* The lanes of the {@link Timeline} around a layer, for one that covers them
|
|
1747
|
+
* all, such as a selected range of time: their ids in the order shown, and
|
|
1748
|
+
* the lane under a pointer.
|
|
1749
|
+
*
|
|
1750
|
+
* @public
|
|
1751
|
+
*/
|
|
1752
|
+
export declare interface TimelineLanes {
|
|
1753
|
+
/** The lanes' ids, top to bottom. Empty in a timeline without lanes. */
|
|
1754
|
+
readonly lanes: readonly string[];
|
|
1755
|
+
/** The id of the lane under a pointer, from its `clientY`, if one is. */
|
|
1756
|
+
readonly laneAt: (clientY: number) => string | undefined;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* A layer of a {@link Timeline} for an editor's own drawing, such as a
|
|
1761
|
+
* waveform or a selected range: a box the size of the track. Layers and
|
|
1762
|
+
* parts stack in the order written. A layer is as tall as its content, and
|
|
1763
|
+
* at least `--hm-timeline-lane-height`.
|
|
1764
|
+
*
|
|
1765
|
+
* What a layer draws is invisible to assistive technology unless you say
|
|
1766
|
+
* otherwise, so give a text equivalent elsewhere, and mark a canvas
|
|
1767
|
+
* `aria-hidden`.
|
|
1768
|
+
*
|
|
1769
|
+
* @public
|
|
1770
|
+
*/
|
|
1771
|
+
export declare const TimelineLayer: ForwardRefExoticComponent<TimelineLayerProps & RefAttributes<HTMLDivElement>>;
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Props of {@link TimelineLayer}.
|
|
1775
|
+
*
|
|
1776
|
+
* @public
|
|
1777
|
+
*/
|
|
1778
|
+
export declare interface TimelineLayerProps extends HTMLAttributes<HTMLDivElement> {
|
|
1779
|
+
/** Your drawing: a canvas, markers, a selection. Size it to the layer. */
|
|
1780
|
+
readonly children?: ReactNode;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* The parts of a timeline that `classNames` can target.
|
|
1785
|
+
*
|
|
1786
|
+
* @public
|
|
1787
|
+
*/
|
|
1788
|
+
export declare type TimelinePart = "root" | "viewport" | "track";
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* The playhead of a {@link Timeline}: a slider over the timeline's units,
|
|
1792
|
+
* and a line on the track at its position.
|
|
1793
|
+
*
|
|
1794
|
+
* - **The slider** is a `ui` `Slider` as wide as the track, so its thumb is
|
|
1795
|
+
* the playhead's handle. Arrow keys move by `step`, Page Up and Page Down
|
|
1796
|
+
* by `largeStep`, and Home and End go to the start and the end.
|
|
1797
|
+
* - **A press on the track** moves the playhead there, snapping to the
|
|
1798
|
+
* timeline's targets unless Alt is held.
|
|
1799
|
+
* - **It's the only part that renders as the playhead moves.** Give it the
|
|
1800
|
+
* position from a component of its own, and nothing else in the timeline
|
|
1801
|
+
* re-renders while playing.
|
|
1802
|
+
*
|
|
1803
|
+
* @public
|
|
1804
|
+
*/
|
|
1805
|
+
export declare const TimelinePlayhead: ForwardRefExoticComponent<TimelinePlayheadProps & RefAttributes<HTMLInputElement>>;
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* The parts of a timeline's playhead that `classNames` can target.
|
|
1809
|
+
*
|
|
1810
|
+
* @public
|
|
1811
|
+
*/
|
|
1812
|
+
export declare type TimelinePlayheadPart = "root" | "slider" | "line";
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* Props of {@link TimelinePlayhead}.
|
|
1816
|
+
*
|
|
1817
|
+
* @public
|
|
1818
|
+
*/
|
|
1819
|
+
export declare interface TimelinePlayheadProps extends StyleProps<TimelinePlayheadPart> {
|
|
1820
|
+
/** The slider's accessible name, such as "Playhead". Required. */
|
|
1821
|
+
readonly label: string;
|
|
1822
|
+
/** Where the playhead is, in the timeline's units. */
|
|
1823
|
+
readonly position: number;
|
|
1824
|
+
/** Called with the unit the user moved the playhead to. */
|
|
1825
|
+
readonly onPositionChange: (position: number) => void;
|
|
1826
|
+
/** The arrow keys' step, in units. Defaults to 1. */
|
|
1827
|
+
readonly step?: number | undefined;
|
|
1828
|
+
/** The Page Up and Page Down step, in units, such as one second. */
|
|
1829
|
+
readonly largeStep?: number | undefined;
|
|
1830
|
+
/**
|
|
1831
|
+
* Writes a position as text for screen readers, such as "0:12.40",
|
|
1832
|
+
* exposed as `aria-valuetext`. Without it, they read the number of units.
|
|
1833
|
+
*/
|
|
1834
|
+
readonly formatValue?: ((position: number) => string) | undefined;
|
|
1835
|
+
/**
|
|
1836
|
+
* Whether a press on the track, outside the clips and controls, moves the
|
|
1837
|
+
* playhead there. Defaults to `true`. Turn it off when a layer of yours
|
|
1838
|
+
* handles presses itself, such as one that selects a range by dragging.
|
|
1839
|
+
*/
|
|
1840
|
+
readonly seekOnPress?: boolean | undefined;
|
|
1841
|
+
/**
|
|
1842
|
+
* Keeps the playhead in view by scrolling, as while playing. Without it,
|
|
1843
|
+
* the timeline scrolls only after a zoom.
|
|
1844
|
+
*/
|
|
1845
|
+
readonly following?: boolean | undefined;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* Props of {@link Timeline}.
|
|
1850
|
+
*
|
|
1851
|
+
* @public
|
|
1852
|
+
*/
|
|
1853
|
+
export declare interface TimelineProps extends Omit<HTMLAttributes<HTMLElement>, "className">, StyleProps<TimelinePart> {
|
|
1854
|
+
/** The timeline's accessible name, such as "Timeline". Required. */
|
|
1855
|
+
readonly label: string;
|
|
1856
|
+
/** The length of what's on the timeline, in whole units, such as frames or samples. */
|
|
1857
|
+
readonly length: number;
|
|
1858
|
+
/**
|
|
1859
|
+
* How far to draw the track, in units, when clips run past `length`, such
|
|
1860
|
+
* as audio that outlasts its video. The playhead still ends at `length`,
|
|
1861
|
+
* and a clip that passes it is marked `data-hm-past-end`. Defaults to
|
|
1862
|
+
* `length`, and is never less.
|
|
1863
|
+
*/
|
|
1864
|
+
readonly extent?: number | undefined;
|
|
1865
|
+
/**
|
|
1866
|
+
* The zoom, as a multiple of fitting `length` to the timeline's width.
|
|
1867
|
+
* Defaults to 1, which fits; less than 1 fits too.
|
|
1868
|
+
*/
|
|
1869
|
+
readonly zoom?: number | undefined;
|
|
1870
|
+
/** The closest zoom, in CSS pixels for one unit. Defaults to 48. */
|
|
1871
|
+
readonly maxPixelsPerUnit?: number | undefined;
|
|
1872
|
+
/**
|
|
1873
|
+
* Called with the largest `zoom` that has an effect, when it changes with
|
|
1874
|
+
* the timeline's width or `length`, so zoom controls know when to stop.
|
|
1875
|
+
*/
|
|
1876
|
+
readonly onMaxZoomChange?: ((maxZoom: number) => void) | undefined;
|
|
1877
|
+
/**
|
|
1878
|
+
* Whether pointers snap to targets, within 8 CSS pixels. Defaults to
|
|
1879
|
+
* `true`. Holding Alt turns it off for one gesture.
|
|
1880
|
+
*/
|
|
1881
|
+
readonly snapping?: boolean | undefined;
|
|
1882
|
+
/** More units to snap to, such as markers. The playhead and the clips' boundaries always are. */
|
|
1883
|
+
readonly snapTargets?: readonly number[] | undefined;
|
|
1884
|
+
/**
|
|
1885
|
+
* Called with the units in view when they change, by scrolling, zooming
|
|
1886
|
+
* or resizing: for a layer that draws only what's visible, such as a
|
|
1887
|
+
* waveform on a canvas.
|
|
1888
|
+
*/
|
|
1889
|
+
readonly onVisibleRangeChange?: ((range: TimelineRange) => void) | undefined;
|
|
1890
|
+
/** The timeline's parts and layers, in the order they stack. */
|
|
1891
|
+
readonly children?: ReactNode;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* A range of a timeline, in whole units: `start` is the first unit in it,
|
|
1896
|
+
* and `end` is the one after its last.
|
|
1897
|
+
*
|
|
1898
|
+
* @public
|
|
1899
|
+
*/
|
|
1900
|
+
export declare interface TimelineRange {
|
|
1901
|
+
readonly start: number;
|
|
1902
|
+
readonly end: number;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* How a {@link Timeline} maps its units to pixels, for the parts and layers
|
|
1907
|
+
* inside it. Units are whole numbers, such as frames or samples
|
|
1908
|
+
* (sdk-core ADR 0042).
|
|
1909
|
+
*
|
|
1910
|
+
* @public
|
|
1911
|
+
*/
|
|
1912
|
+
export declare interface TimelineScale {
|
|
1913
|
+
/** The timeline's length, in units: as far as the playhead goes. */
|
|
1914
|
+
readonly length: number;
|
|
1915
|
+
/**
|
|
1916
|
+
* How far the track is drawn, in units: `length`, or more when clips run
|
|
1917
|
+
* past it.
|
|
1918
|
+
*/
|
|
1919
|
+
readonly extent: number;
|
|
1920
|
+
/**
|
|
1921
|
+
* CSS pixels for one unit at the current zoom. It's 0 until the timeline
|
|
1922
|
+
* has measured itself, which is after the first render in a browser, and
|
|
1923
|
+
* always on a server.
|
|
1924
|
+
*/
|
|
1925
|
+
readonly pixelsPerUnit: number;
|
|
1926
|
+
/** A unit's distance from the start of the track, in CSS pixels. */
|
|
1927
|
+
readonly toPixels: (unit: number) => number;
|
|
1928
|
+
/**
|
|
1929
|
+
* The unit under a pointer, from its `clientX`, within `0…extent`. It
|
|
1930
|
+
* follows the reading direction. With `snap`, it snaps to the timeline's
|
|
1931
|
+
* targets when `snapping` is on.
|
|
1932
|
+
*/
|
|
1933
|
+
readonly unitAt: (clientX: number, options?: {
|
|
1934
|
+
readonly snap?: boolean;
|
|
1935
|
+
}) => number;
|
|
1936
|
+
/** A unit snapped to the nearest target within reach, or itself. */
|
|
1937
|
+
readonly snap: (unit: number) => number;
|
|
1938
|
+
/** The units in view now. Read it when you draw; it isn't state. */
|
|
1939
|
+
readonly visibleRange: () => TimelineRange;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1458
1942
|
/**
|
|
1459
1943
|
* A button that turns something on or off, such as loop playback or the
|
|
1460
1944
|
* active tool, exposed as `aria-pressed`. Controlled with `pressed` and
|
|
@@ -1812,6 +2296,29 @@ export declare function useAnnounce(): Announce;
|
|
|
1812
2296
|
*/
|
|
1813
2297
|
export declare function usePlatform(): Platform;
|
|
1814
2298
|
|
|
2299
|
+
/**
|
|
2300
|
+
* The lanes of the {@link Timeline} around a layer or a part.
|
|
2301
|
+
*
|
|
2302
|
+
* @public
|
|
2303
|
+
*/
|
|
2304
|
+
export declare function useTimelineLanes(): TimelineLanes;
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* The scale of the {@link Timeline} around a layer or a part: units to
|
|
2308
|
+
* pixels and back, snapping, and the range in view.
|
|
2309
|
+
*
|
|
2310
|
+
* @example
|
|
2311
|
+
* ```tsx
|
|
2312
|
+
* function Markers({ at }: { at: readonly number[] }) {
|
|
2313
|
+
* const scale = useTimelineScale();
|
|
2314
|
+
* // Draw each marker at scale.toPixels(unit); hit-test with scale.unitAt(event.clientX).
|
|
2315
|
+
* }
|
|
2316
|
+
* ```
|
|
2317
|
+
*
|
|
2318
|
+
* @public
|
|
2319
|
+
*/
|
|
2320
|
+
export declare function useTimelineScale(): TimelineScale;
|
|
2321
|
+
|
|
1815
2322
|
/**
|
|
1816
2323
|
* The messages from the closest {@link UiMessagesProvider}, or English.
|
|
1817
2324
|
*
|