@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/dist/styles.css CHANGED
@@ -476,6 +476,22 @@
476
476
  color-scheme: var(--hm-color-scheme);
477
477
  }
478
478
 
479
+ /*
480
+ * An opt-in root for text that isn't inside a component, such as an SDK
481
+ * editor's own labels and values: ui's type and text colour, instead of
482
+ * whatever the host page sets around it. Components set their own, so they
483
+ * don't need it. It's in the lowest layer, so an SDK's rules in hm.sdk and
484
+ * any host CSS still win.
485
+ */
486
+ .hm-text {
487
+ color: var(--hm-color-text);
488
+ font-family: var(--hm-font-family);
489
+ font-size: var(--hm-font-size-body);
490
+ font-weight: var(--hm-font-weight-regular);
491
+ letter-spacing: var(--hm-letter-spacing);
492
+ line-height: var(--hm-line-height-body);
493
+ }
494
+
479
495
  /*
480
496
  * ThemeProvider's wrapper. Custom properties still inherit through it,
481
497
  * because inheritance follows the DOM tree, not boxes.
@@ -1631,3 +1647,337 @@
1631
1647
  }
1632
1648
  }
1633
1649
  }
1650
+ @layer hm.components {
1651
+ /*
1652
+ * Layout: kept with unstyled. The track is as wide as the timeline's
1653
+ * length at the current zoom; Timeline.tsx sets its inline size. Its two
1654
+ * rows are the playhead's slider, then the lane the layers and clips
1655
+ * share, stacked in the order written.
1656
+ */
1657
+ .hm-timeline {
1658
+ box-sizing: border-box;
1659
+ display: block;
1660
+ min-inline-size: 0;
1661
+ }
1662
+
1663
+ /*
1664
+ * Half a thumb of room at each end, so the slider's thumb can sit on the
1665
+ * first and last units without being clipped.
1666
+ */
1667
+ .hm-timeline-viewport {
1668
+ box-sizing: border-box;
1669
+ overflow: auto hidden;
1670
+ padding-inline: calc(var(--hm-slider-thumb-size, var(--hm-icon-size)) / 2);
1671
+ }
1672
+
1673
+ .hm-timeline-track {
1674
+ box-sizing: border-box;
1675
+ display: grid;
1676
+ grid-template-columns: minmax(0, 1fr);
1677
+ grid-template-rows:
1678
+ max(var(--hm-slider-thumb-size, var(--hm-icon-size)), var(--hm-target-size))
1679
+ minmax(var(--hm-timeline-lane-height, var(--hm-control-height)), auto);
1680
+ isolation: isolate;
1681
+ min-inline-size: 100%;
1682
+ position: relative;
1683
+ }
1684
+
1685
+ .hm-timeline-track > * {
1686
+ grid-column: 1;
1687
+ grid-row: 2;
1688
+ min-inline-size: 0;
1689
+ }
1690
+
1691
+ .hm-timeline-layer {
1692
+ box-sizing: border-box;
1693
+ }
1694
+
1695
+ /*
1696
+ * The clips, side by side. Until the timeline has measured itself, as on
1697
+ * a server, they share the track equally; then TimelineClips.tsx sets each
1698
+ * one's inline size.
1699
+ */
1700
+ /*
1701
+ * Only the clips take the pointer: between them, and beside a clip's
1702
+ * title when that's its handle, a press reaches what's under the track,
1703
+ * such as a layer that selects a range of time.
1704
+ */
1705
+ .hm-timeline-clips {
1706
+ box-sizing: border-box;
1707
+ display: flex;
1708
+ pointer-events: none;
1709
+ }
1710
+
1711
+ .hm-timeline-clip {
1712
+ align-items: center;
1713
+ box-sizing: border-box;
1714
+ cursor: pointer;
1715
+ display: flex;
1716
+ flex: 1 1 0;
1717
+ min-inline-size: 0;
1718
+ overflow: hidden;
1719
+ pointer-events: auto;
1720
+ position: relative;
1721
+ user-select: none;
1722
+ }
1723
+
1724
+ .hm-timeline-clips[data-hm-measured] > .hm-timeline-clip {
1725
+ flex: none;
1726
+ }
1727
+
1728
+ /*
1729
+ * A clip's edges, for dragging: at most a third of the clip each, so a
1730
+ * narrow clip keeps a middle to press.
1731
+ */
1732
+ .hm-timeline-clip-edge {
1733
+ cursor: ew-resize;
1734
+ inline-size: min(var(--hm-timeline-clip-edge-size, var(--hm-gap-normal)), 33%);
1735
+ inset-block: 0;
1736
+ position: absolute;
1737
+ touch-action: none;
1738
+ }
1739
+
1740
+ .hm-timeline-clip-edge[data-hm-edge="start"] {
1741
+ inset-inline-start: 0;
1742
+ }
1743
+
1744
+ .hm-timeline-clip-edge[data-hm-edge="end"] {
1745
+ inset-inline-end: 0;
1746
+ }
1747
+
1748
+ /* Inside the clip, where its neighbours and the track's edge can't cover it. */
1749
+ .hm-timeline-clip:focus-visible {
1750
+ outline: var(--hm-focus-ring);
1751
+ outline-offset: calc(var(--hm-focus-ring-width) * -1);
1752
+ }
1753
+
1754
+ .hm-timeline-clip-content {
1755
+ min-inline-size: 0;
1756
+ overflow: hidden;
1757
+ padding-inline: var(--hm-timeline-clip-padding-x, var(--hm-gap-tight));
1758
+ text-overflow: ellipsis;
1759
+ white-space: nowrap;
1760
+ }
1761
+
1762
+ /*
1763
+ * Clips that can be dragged. A dragged clip is above the lanes and the
1764
+ * playhead as it follows the pointer; TimelineClips.tsx moves it.
1765
+ */
1766
+ .hm-timeline-clips[data-hm-move-handle="clip"] > .hm-timeline-clip,
1767
+ .hm-timeline-clips[data-hm-move-handle="title"] .hm-timeline-clip-content {
1768
+ cursor: grab;
1769
+ }
1770
+
1771
+ /*
1772
+ * With the title as the handle, the rest of a clip lets a press through
1773
+ * to the layer under it, such as one that selects a range of time.
1774
+ */
1775
+ .hm-timeline-clips[data-hm-move-handle="title"] > .hm-timeline-clip {
1776
+ pointer-events: none;
1777
+ }
1778
+
1779
+ .hm-timeline-clips[data-hm-move-handle="title"] .hm-timeline-clip-content,
1780
+ .hm-timeline-clips[data-hm-move-handle="title"] .hm-timeline-clip-edge {
1781
+ pointer-events: auto;
1782
+ }
1783
+
1784
+ .hm-timeline-clips > .hm-timeline-clip[data-hm-moving] {
1785
+ cursor: grabbing;
1786
+ z-index: var(--hm-z-sticky);
1787
+ }
1788
+
1789
+ .hm-timeline-clips > .hm-timeline-clip[data-hm-moving="refused"] {
1790
+ cursor: not-allowed;
1791
+ }
1792
+
1793
+ /* Over both rows, and above the layers; only its slider takes the pointer. */
1794
+ .hm-timeline-playhead {
1795
+ grid-row: 1 / 3;
1796
+ pointer-events: none;
1797
+ position: relative;
1798
+ z-index: var(--hm-z-raised);
1799
+ }
1800
+
1801
+ .hm-timeline-playhead-slider {
1802
+ pointer-events: auto;
1803
+ }
1804
+
1805
+ /* Timeline.tsx sets its inline start; it's centred on that unit. */
1806
+ .hm-timeline-playhead-line {
1807
+ inline-size: 0;
1808
+ inset-block: 0;
1809
+ inset-inline-start: 0;
1810
+ margin-inline-start: calc(var(--hm-focus-ring-width) / -2);
1811
+ position: absolute;
1812
+ }
1813
+
1814
+ /*
1815
+ * Lanes. Each is a row of the track, under the slider's, with its own
1816
+ * layers and clips stacked in it; Timeline.tsx gives each its row. Their
1817
+ * headers share a column before the first unit, in room the timeline adds
1818
+ * to the viewport's padding, and stay there as the track scrolls.
1819
+ */
1820
+ .hm-timeline[data-hm-lanes] .hm-timeline-viewport {
1821
+ overflow: auto;
1822
+ }
1823
+
1824
+ .hm-timeline[data-hm-lanes] .hm-timeline-track {
1825
+ grid-auto-rows: minmax(var(--hm-timeline-lane-height, var(--hm-control-height)), auto);
1826
+ grid-template-rows: max(
1827
+ var(--hm-slider-thumb-size, var(--hm-icon-size)),
1828
+ var(--hm-target-size)
1829
+ );
1830
+ }
1831
+
1832
+ /*
1833
+ * Two columns: the header's, as wide as the header and nothing without
1834
+ * one, then the lane's layers and clips, stacked. TimelineLane.tsx pulls
1835
+ * the lane back over the room kept for the headers, so the header has a
1836
+ * box to stay in.
1837
+ */
1838
+ .hm-timeline-lane {
1839
+ box-sizing: border-box;
1840
+ display: grid;
1841
+ grid-template-columns: auto minmax(0, 1fr);
1842
+ }
1843
+
1844
+ .hm-timeline-lane > * {
1845
+ grid-column: 2;
1846
+ grid-row: 1;
1847
+ min-inline-size: 0;
1848
+ }
1849
+
1850
+ .hm-timeline-lane > .hm-timeline-lane-header {
1851
+ align-items: center;
1852
+ box-sizing: border-box;
1853
+ display: flex;
1854
+ grid-column: 1;
1855
+ inset-inline-start: 0;
1856
+ overflow: hidden;
1857
+ position: sticky;
1858
+ z-index: var(--hm-z-sticky);
1859
+ }
1860
+
1861
+ /* As wide as its controls, so the timeline can tell how wide the column must be. */
1862
+ .hm-timeline-lane-toolbar {
1863
+ flex: none;
1864
+ inline-size: max-content;
1865
+ max-inline-size: var(--hm-timeline-header-max-width, var(--hm-surface-width-small));
1866
+ }
1867
+
1868
+ /* The slider's row stays at the top as the lanes scroll under it. */
1869
+ .hm-timeline-bar {
1870
+ grid-column: 1;
1871
+ grid-row: 1;
1872
+ inset-block-start: 0;
1873
+ position: sticky;
1874
+ z-index: var(--hm-z-raised);
1875
+ }
1876
+
1877
+ .hm-timeline[data-hm-lanes] .hm-timeline-playhead-slider {
1878
+ inset-block-start: 0;
1879
+ position: sticky;
1880
+ }
1881
+
1882
+ /* Only its cover takes the pointer: the rest of the row is the slider's. */
1883
+ .hm-timeline-corner {
1884
+ grid-column: 1;
1885
+ grid-row: 1;
1886
+ inset-block-start: 0;
1887
+ pointer-events: none;
1888
+ position: sticky;
1889
+ z-index: var(--hm-z-sticky);
1890
+ }
1891
+
1892
+ .hm-timeline-corner-cover {
1893
+ block-size: 100%;
1894
+ inset-inline-start: 0;
1895
+ pointer-events: auto;
1896
+ position: sticky;
1897
+ }
1898
+
1899
+ /* Where the timeline is narrow, each header sits above its lane. */
1900
+ .hm-timeline[data-hm-lanes="above"] .hm-timeline-lane {
1901
+ grid-template-rows: auto minmax(var(--hm-timeline-lane-height, var(--hm-control-height)), auto);
1902
+ }
1903
+
1904
+ .hm-timeline[data-hm-lanes="above"] .hm-timeline-lane > * {
1905
+ grid-row: 2;
1906
+ }
1907
+
1908
+ .hm-timeline[data-hm-lanes="above"] .hm-timeline-lane > .hm-timeline-lane-header {
1909
+ grid-column: 1 / -1;
1910
+ grid-row: 1;
1911
+ justify-self: start;
1912
+ }
1913
+
1914
+ /* Visual styles, dropped with unstyled. */
1915
+ /* On the viewport, so it's behind the slider's ends too, and stays put while the track scrolls. */
1916
+ .hm-timeline:not([data-hm-unstyled]) .hm-timeline-viewport {
1917
+ background: var(--hm-timeline-track-bg, var(--hm-color-surface-sunken));
1918
+ border-radius: var(--hm-timeline-track-radius, var(--hm-radius-control));
1919
+ }
1920
+
1921
+ /*
1922
+ * A thumb wider than the track by its own size travels from the first
1923
+ * unit to the last, so its centre is where the line is. It needs the
1924
+ * styled thumb, whose size is the token's.
1925
+ */
1926
+ .hm-timeline-playhead:not([data-hm-unstyled]) .hm-timeline-playhead-slider {
1927
+ inline-size: calc(100% + var(--hm-slider-thumb-size, var(--hm-icon-size)));
1928
+ margin-inline: calc(var(--hm-slider-thumb-size, var(--hm-icon-size)) / -2);
1929
+ }
1930
+
1931
+ /* A border, so forced-colours mode draws it. */
1932
+ .hm-timeline-playhead:not([data-hm-unstyled]) .hm-timeline-playhead-line {
1933
+ border-inline-start: var(--hm-focus-ring-width) solid
1934
+ var(--hm-timeline-playhead-color, var(--hm-color-accent));
1935
+ }
1936
+
1937
+ .hm-timeline-clips:not([data-hm-unstyled]) > .hm-timeline-clip {
1938
+ background: var(--hm-timeline-clip-bg, var(--hm-color-control));
1939
+ border: var(--hm-border-width) solid
1940
+ var(--hm-timeline-clip-border-color, var(--hm-color-border-strong));
1941
+ border-radius: var(--hm-timeline-clip-radius, var(--hm-radius-control));
1942
+ color: var(--hm-timeline-clip-fg, var(--hm-color-text));
1943
+ font-family: var(--hm-font-family);
1944
+ font-size: var(--hm-font-size-small);
1945
+ letter-spacing: var(--hm-letter-spacing);
1946
+ line-height: var(--hm-line-height-tight);
1947
+ }
1948
+
1949
+ /* A thicker border as well as a colour, so selection isn't shown by colour alone. */
1950
+ .hm-timeline-clips:not([data-hm-unstyled]) > .hm-timeline-clip[aria-selected="true"] {
1951
+ background: var(--hm-timeline-clip-selected-bg, var(--hm-color-accent-subtle));
1952
+ border-color: var(--hm-timeline-clip-selected-border-color, var(--hm-color-accent));
1953
+ border-width: var(--hm-focus-ring-width);
1954
+ }
1955
+
1956
+ /* The clip whose edge is being dragged. */
1957
+ .hm-timeline-clips:not([data-hm-unstyled]) > .hm-timeline-clip[data-hm-dragging] {
1958
+ border-color: var(--hm-timeline-clip-selected-border-color, var(--hm-color-accent));
1959
+ }
1960
+
1961
+ /* Opaque, so clips and the slider's rail pass under them. */
1962
+ .hm-timeline:not([data-hm-unstyled]) .hm-timeline-lane > .hm-timeline-lane-header,
1963
+ .hm-timeline:not([data-hm-unstyled]) .hm-timeline-corner-cover,
1964
+ .hm-timeline:not([data-hm-unstyled]) .hm-timeline-bar {
1965
+ background: var(--hm-timeline-header-bg, var(--hm-color-surface));
1966
+ }
1967
+
1968
+ .hm-timeline:not([data-hm-unstyled]) .hm-timeline-lane {
1969
+ border-block-start: var(--hm-border-width) solid
1970
+ var(--hm-timeline-lane-border-color, var(--hm-color-border));
1971
+ }
1972
+
1973
+ /* A clip being dragged, and one that can't be dropped where it is. */
1974
+ .hm-timeline-clips:not([data-hm-unstyled]) > .hm-timeline-clip[data-hm-moving] {
1975
+ border-color: var(--hm-timeline-clip-selected-border-color, var(--hm-color-accent));
1976
+ box-shadow: var(--hm-timeline-clip-moving-shadow, var(--hm-shadow-raised));
1977
+ }
1978
+
1979
+ .hm-timeline-clips:not([data-hm-unstyled]) > .hm-timeline-clip[data-hm-moving="refused"] {
1980
+ border-color: var(--hm-timeline-clip-refused-border-color, var(--hm-color-danger-text));
1981
+ border-style: dashed;
1982
+ }
1983
+ }