@hussmartinez/ui 0.11.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +151 -3
- package/dist/react.js +557 -100
- package/dist/react.js.map +1 -1
- package/dist/styles.css +161 -0
- package/dist/ui.d.ts +151 -3
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -1498,10 +1498,17 @@ export declare interface TimelineClip {
|
|
|
1498
1498
|
readonly key: string;
|
|
1499
1499
|
/** The clip's length, in the timeline's units: a whole number, at least 1. */
|
|
1500
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;
|
|
1501
1507
|
/**
|
|
1502
1508
|
* The clip's accessible name, with its place and range, such as
|
|
1503
1509
|
* "Clip 2 of 5, 0:04.00 to 0:09.20, muted". Use text from your message
|
|
1504
|
-
* catalogue.
|
|
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).
|
|
1505
1512
|
*/
|
|
1506
1513
|
readonly label: string;
|
|
1507
1514
|
/** What the clip shows, such as its name or a thumbnail. It's cut off where the clip ends. */
|
|
@@ -1510,6 +1517,18 @@ export declare interface TimelineClip {
|
|
|
1510
1517
|
readonly attributes?: Readonly<Record<`data-${string}`, string | undefined>> | undefined;
|
|
1511
1518
|
}
|
|
1512
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
|
+
|
|
1513
1532
|
/**
|
|
1514
1533
|
* A clip's edge: its start, or its end.
|
|
1515
1534
|
*
|
|
@@ -1625,6 +1644,116 @@ export declare interface TimelineClipsProps extends StyleProps<TimelineClipsPart
|
|
|
1625
1644
|
readonly min?: number;
|
|
1626
1645
|
readonly max?: number;
|
|
1627
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;
|
|
1628
1757
|
}
|
|
1629
1758
|
|
|
1630
1759
|
/**
|
|
@@ -1726,6 +1855,13 @@ export declare interface TimelineProps extends Omit<HTMLAttributes<HTMLElement>,
|
|
|
1726
1855
|
readonly label: string;
|
|
1727
1856
|
/** The length of what's on the timeline, in whole units, such as frames or samples. */
|
|
1728
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;
|
|
1729
1865
|
/**
|
|
1730
1866
|
* The zoom, as a multiple of fitting `length` to the timeline's width.
|
|
1731
1867
|
* Defaults to 1, which fits; less than 1 fits too.
|
|
@@ -1774,8 +1910,13 @@ export declare interface TimelineRange {
|
|
|
1774
1910
|
* @public
|
|
1775
1911
|
*/
|
|
1776
1912
|
export declare interface TimelineScale {
|
|
1777
|
-
/** The timeline's length, in units. */
|
|
1913
|
+
/** The timeline's length, in units: as far as the playhead goes. */
|
|
1778
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;
|
|
1779
1920
|
/**
|
|
1780
1921
|
* CSS pixels for one unit at the current zoom. It's 0 until the timeline
|
|
1781
1922
|
* has measured itself, which is after the first render in a browser, and
|
|
@@ -1785,7 +1926,7 @@ export declare interface TimelineScale {
|
|
|
1785
1926
|
/** A unit's distance from the start of the track, in CSS pixels. */
|
|
1786
1927
|
readonly toPixels: (unit: number) => number;
|
|
1787
1928
|
/**
|
|
1788
|
-
* The unit under a pointer, from its `clientX`, within `0…
|
|
1929
|
+
* The unit under a pointer, from its `clientX`, within `0…extent`. It
|
|
1789
1930
|
* follows the reading direction. With `snap`, it snaps to the timeline's
|
|
1790
1931
|
* targets when `snapping` is on.
|
|
1791
1932
|
*/
|
|
@@ -2155,6 +2296,13 @@ export declare function useAnnounce(): Announce;
|
|
|
2155
2296
|
*/
|
|
2156
2297
|
export declare function usePlatform(): Platform;
|
|
2157
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
|
+
|
|
2158
2306
|
/**
|
|
2159
2307
|
* The scale of the {@link Timeline} around a layer or a part: units to
|
|
2160
2308
|
* pixels and back, snapping, and the range in view.
|