@waveform-playlist/ui-components 13.1.4 → 13.2.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/index.mjs CHANGED
@@ -3226,9 +3226,103 @@ import { DotsThreeIcon } from "@phosphor-icons/react";
3226
3226
  import { jsx as jsx34 } from "react/jsx-runtime";
3227
3227
  var DotsIcon = (props) => /* @__PURE__ */ jsx34(DotsThreeIcon, { weight: "bold", ...props });
3228
3228
 
3229
- // src/components/TrackControls/Slider.tsx
3229
+ // src/components/TrackControls/GripIcon.tsx
3230
+ import { DotsSixVerticalIcon } from "@phosphor-icons/react";
3231
+ import { jsx as jsx35 } from "react/jsx-runtime";
3232
+ var GripIcon = (props) => /* @__PURE__ */ jsx35(DotsSixVerticalIcon, { weight: "bold", ...props });
3233
+
3234
+ // src/components/TrackControls/MoveUpIcon.tsx
3235
+ import { CaretUpIcon } from "@phosphor-icons/react";
3236
+ import { jsx as jsx36 } from "react/jsx-runtime";
3237
+ var MoveUpIcon = (props) => /* @__PURE__ */ jsx36(CaretUpIcon, { weight: "bold", ...props });
3238
+
3239
+ // src/components/TrackControls/MoveDownIcon.tsx
3240
+ import { CaretDownIcon } from "@phosphor-icons/react";
3241
+ import { jsx as jsx37 } from "react/jsx-runtime";
3242
+ var MoveDownIcon = (props) => /* @__PURE__ */ jsx37(CaretDownIcon, { weight: "bold", ...props });
3243
+
3244
+ // src/components/TrackControls/ReorderRail.tsx
3230
3245
  import styled31 from "styled-components";
3231
- var Slider = styled31(BaseSlider)`
3246
+ import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
3247
+ var Rail = styled31.div`
3248
+ display: flex;
3249
+ flex-direction: column;
3250
+ align-items: center;
3251
+ gap: 2px;
3252
+ color: ${(props) => props.theme.textColor};
3253
+ opacity: 0.55;
3254
+ transition: opacity 0.15s ease-in-out;
3255
+
3256
+ &:hover,
3257
+ &:focus-within {
3258
+ opacity: 1;
3259
+ }
3260
+ `;
3261
+ var RailButton = styled31.button.attrs({ type: "button" })`
3262
+ border: none;
3263
+ background: transparent;
3264
+ color: inherit;
3265
+ padding: 0;
3266
+ display: flex;
3267
+ align-items: center;
3268
+ justify-content: center;
3269
+ border-radius: ${(props) => props.theme.borderRadius};
3270
+
3271
+ &:focus-visible {
3272
+ outline: none;
3273
+ box-shadow: 0 0 0 0.2rem ${(props) => props.theme.inputFocusBorder}33;
3274
+ }
3275
+ `;
3276
+ var ChevronButton = styled31(RailButton)`
3277
+ width: 16px;
3278
+ height: 14px;
3279
+ cursor: pointer;
3280
+
3281
+ &:hover:not(:disabled) {
3282
+ background: ${(props) => props.theme.borderColor};
3283
+ }
3284
+
3285
+ &:disabled {
3286
+ opacity: 0.15;
3287
+ cursor: default;
3288
+ }
3289
+ `;
3290
+ var GripButton = styled31(RailButton)`
3291
+ width: 16px;
3292
+ height: 20px;
3293
+ cursor: grab;
3294
+ touch-action: none;
3295
+
3296
+ &:active {
3297
+ cursor: grabbing;
3298
+ }
3299
+ `;
3300
+ var ReorderRail = ({
3301
+ onMoveUp,
3302
+ onMoveDown,
3303
+ upDisabled = false,
3304
+ downDisabled = false,
3305
+ gripRef,
3306
+ onGripClick,
3307
+ style
3308
+ }) => /* @__PURE__ */ jsxs11(Rail, { style, children: [
3309
+ /* @__PURE__ */ jsx38(ChevronButton, { "aria-label": "Move track up", disabled: upDisabled, onClick: onMoveUp, children: /* @__PURE__ */ jsx38(MoveUpIcon, { size: 12 }) }),
3310
+ /* @__PURE__ */ jsx38(
3311
+ GripButton,
3312
+ {
3313
+ ref: gripRef,
3314
+ "aria-label": "Drag to reorder track",
3315
+ title: "Drag to reorder track",
3316
+ onClick: onGripClick,
3317
+ children: /* @__PURE__ */ jsx38(GripIcon, { size: 14 })
3318
+ }
3319
+ ),
3320
+ /* @__PURE__ */ jsx38(ChevronButton, { "aria-label": "Move track down", disabled: downDisabled, onClick: onMoveDown, children: /* @__PURE__ */ jsx38(MoveDownIcon, { size: 12 }) })
3321
+ ] });
3322
+
3323
+ // src/components/TrackControls/Slider.tsx
3324
+ import styled32 from "styled-components";
3325
+ var Slider = styled32(BaseSlider)`
3232
3326
  width: 75%;
3233
3327
  height: 5px;
3234
3328
  background: ${(props) => props.theme.sliderTrackColor};
@@ -3280,8 +3374,8 @@ var Slider = styled31(BaseSlider)`
3280
3374
  `;
3281
3375
 
3282
3376
  // src/components/TrackControls/SliderWrapper.tsx
3283
- import styled32 from "styled-components";
3284
- var SliderWrapper = styled32.label`
3377
+ import styled33 from "styled-components";
3378
+ var SliderWrapper = styled33.label`
3285
3379
  width: 100%;
3286
3380
  display: flex;
3287
3381
  justify-content: space-between;
@@ -3294,13 +3388,13 @@ var SliderWrapper = styled32.label`
3294
3388
  // src/components/TrackMenu.tsx
3295
3389
  import React20, { useState as useState6, useEffect as useEffect7, useRef as useRef9, useCallback as useCallback5 } from "react";
3296
3390
  import { createPortal } from "react-dom";
3297
- import styled33 from "styled-components";
3298
- import { jsx as jsx35, jsxs as jsxs11 } from "react/jsx-runtime";
3299
- var MenuContainer = styled33.div`
3391
+ import styled34 from "styled-components";
3392
+ import { jsx as jsx39, jsxs as jsxs12 } from "react/jsx-runtime";
3393
+ var MenuContainer = styled34.div`
3300
3394
  position: relative;
3301
3395
  display: inline-block;
3302
3396
  `;
3303
- var MenuButton = styled33.button`
3397
+ var MenuButton = styled34.button`
3304
3398
  background: none;
3305
3399
  border: none;
3306
3400
  cursor: pointer;
@@ -3316,7 +3410,7 @@ var MenuButton = styled33.button`
3316
3410
  }
3317
3411
  `;
3318
3412
  var DROPDOWN_MIN_WIDTH = 180;
3319
- var Dropdown = styled33.div`
3413
+ var Dropdown = styled34.div`
3320
3414
  position: fixed;
3321
3415
  top: ${(p) => p.$top}px;
3322
3416
  left: ${(p) => p.$left}px;
@@ -3329,7 +3423,7 @@ var Dropdown = styled33.div`
3329
3423
  min-width: ${DROPDOWN_MIN_WIDTH}px;
3330
3424
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
3331
3425
  `;
3332
- var Divider = styled33.hr`
3426
+ var Divider = styled34.hr`
3333
3427
  border: none;
3334
3428
  border-top: 1px solid rgba(128, 128, 128, 0.3);
3335
3429
  margin: 0.35rem 0;
@@ -3392,8 +3486,8 @@ var TrackMenu = ({ items: itemsProp }) => {
3392
3486
  document.removeEventListener("keydown", handleKeyDown);
3393
3487
  };
3394
3488
  }, [open]);
3395
- return /* @__PURE__ */ jsxs11(MenuContainer, { children: [
3396
- /* @__PURE__ */ jsx35(
3489
+ return /* @__PURE__ */ jsxs12(MenuContainer, { children: [
3490
+ /* @__PURE__ */ jsx39(
3397
3491
  MenuButton,
3398
3492
  {
3399
3493
  ref: buttonRef,
@@ -3404,19 +3498,19 @@ var TrackMenu = ({ items: itemsProp }) => {
3404
3498
  onMouseDown: (e) => e.stopPropagation(),
3405
3499
  title: "Track menu",
3406
3500
  "aria-label": "Track menu",
3407
- children: /* @__PURE__ */ jsx35(DotsIcon, { size: 16 })
3501
+ children: /* @__PURE__ */ jsx39(DotsIcon, { size: 16 })
3408
3502
  }
3409
3503
  ),
3410
3504
  open && typeof document !== "undefined" && createPortal(
3411
- /* @__PURE__ */ jsx35(
3505
+ /* @__PURE__ */ jsx39(
3412
3506
  Dropdown,
3413
3507
  {
3414
3508
  ref: dropdownRef,
3415
3509
  $top: dropdownPos.top,
3416
3510
  $left: dropdownPos.left,
3417
3511
  onMouseDown: (e) => e.stopPropagation(),
3418
- children: items.map((item, index) => /* @__PURE__ */ jsxs11(React20.Fragment, { children: [
3419
- index > 0 && /* @__PURE__ */ jsx35(Divider, {}),
3512
+ children: items.map((item, index) => /* @__PURE__ */ jsxs12(React20.Fragment, { children: [
3513
+ index > 0 && /* @__PURE__ */ jsx39(Divider, {}),
3420
3514
  item.content
3421
3515
  ] }, item.id))
3422
3516
  }
@@ -3428,9 +3522,9 @@ var TrackMenu = ({ items: itemsProp }) => {
3428
3522
 
3429
3523
  // src/components/SegmentedVUMeter.tsx
3430
3524
  import React21, { useMemo as useMemo5 } from "react";
3431
- import styled34 from "styled-components";
3525
+ import styled35 from "styled-components";
3432
3526
  import { normalizedToDb } from "@waveform-playlist/core";
3433
- import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
3527
+ import { jsx as jsx40, jsxs as jsxs13 } from "react/jsx-runtime";
3434
3528
  var DEFAULT_COLOR_STOPS = [
3435
3529
  { dB: 2, color: "#ff0000" },
3436
3530
  { dB: -1, color: "#e74c3c" },
@@ -3467,23 +3561,23 @@ function computeThresholds(segmentCount, dBRange) {
3467
3561
  function formatDbLabel(dB) {
3468
3562
  return Math.round(dB).toString();
3469
3563
  }
3470
- var MeterContainer = styled34.div`
3564
+ var MeterContainer = styled35.div`
3471
3565
  display: inline-flex;
3472
3566
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "column" : "row"};
3473
3567
  gap: 4px;
3474
3568
  font-family: 'Courier New', monospace;
3475
3569
  `;
3476
- var ChannelColumn = styled34.div`
3570
+ var ChannelColumn = styled35.div`
3477
3571
  display: flex;
3478
3572
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "row" : "column"};
3479
3573
  align-items: center;
3480
3574
  gap: 4px;
3481
3575
  `;
3482
- var SegmentStack = styled34.div`
3576
+ var SegmentStack = styled35.div`
3483
3577
  display: flex;
3484
3578
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "row" : "column"};
3485
3579
  `;
3486
- var Segment = styled34.div.attrs((props) => ({
3580
+ var Segment = styled35.div.attrs((props) => ({
3487
3581
  style: {
3488
3582
  width: `${props.$width}px`,
3489
3583
  height: `${props.$height}px`,
@@ -3496,19 +3590,19 @@ var Segment = styled34.div.attrs((props) => ({
3496
3590
  border-radius: 1px;
3497
3591
  `;
3498
3592
  var DEFAULT_LABEL_COLOR = "#888";
3499
- var ChannelLabel = styled34.div`
3593
+ var ChannelLabel = styled35.div`
3500
3594
  color: ${(props) => props.$labelColor};
3501
3595
  font-size: 10px;
3502
3596
  text-align: center;
3503
3597
  user-select: none;
3504
3598
  `;
3505
- var ScaleColumn = styled34.div`
3599
+ var ScaleColumn = styled35.div`
3506
3600
  display: flex;
3507
3601
  flex-direction: column;
3508
3602
  position: relative;
3509
3603
  min-width: 28px;
3510
3604
  `;
3511
- var ScaleLabel = styled34.div.attrs((props) => ({
3605
+ var ScaleLabel = styled35.div.attrs((props) => ({
3512
3606
  style: {
3513
3607
  top: `${props.$top}px`,
3514
3608
  color: props.$labelColor
@@ -3522,19 +3616,19 @@ var ScaleLabel = styled34.div.attrs((props) => ({
3522
3616
  transform: translate(-50%, -50%);
3523
3617
  user-select: none;
3524
3618
  `;
3525
- var HorizontalScaleWrapper = styled34.div`
3619
+ var HorizontalScaleWrapper = styled35.div`
3526
3620
  display: flex;
3527
3621
  flex-direction: row;
3528
3622
  align-items: center;
3529
3623
  gap: 4px;
3530
3624
  `;
3531
- var ScaleRow = styled34.div`
3625
+ var ScaleRow = styled35.div`
3532
3626
  display: flex;
3533
3627
  flex-direction: row;
3534
3628
  position: relative;
3535
3629
  min-height: 16px;
3536
3630
  `;
3537
- var ScaleLabelHorizontal = styled34.div.attrs((props) => ({
3631
+ var ScaleLabelHorizontal = styled35.div.attrs((props) => ({
3538
3632
  style: {
3539
3633
  left: `${props.$left}px`,
3540
3634
  color: props.$labelColor
@@ -3618,13 +3712,13 @@ var SegmentedVUMeterInner = ({
3618
3712
  }
3619
3713
  }
3620
3714
  }
3621
- return /* @__PURE__ */ jsxs12(ChannelColumn, { $orientation: orientation, "data-channel": true, children: [
3622
- orientation === "horizontal" && /* @__PURE__ */ jsx36(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] }),
3623
- /* @__PURE__ */ jsx36(SegmentStack, { $orientation: orientation, children: renderThresholds.map((threshold, segIdx) => {
3715
+ return /* @__PURE__ */ jsxs13(ChannelColumn, { $orientation: orientation, "data-channel": true, children: [
3716
+ orientation === "horizontal" && /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] }),
3717
+ /* @__PURE__ */ jsx40(SegmentStack, { $orientation: orientation, children: renderThresholds.map((threshold, segIdx) => {
3624
3718
  const active = levelDb >= threshold;
3625
3719
  const isPeak = segIdx === peakSegmentIndex;
3626
3720
  const color = getColorForDb(threshold, colorStops);
3627
- return /* @__PURE__ */ jsx36(
3721
+ return /* @__PURE__ */ jsx40(
3628
3722
  Segment,
3629
3723
  {
3630
3724
  $width: orientation === "horizontal" ? segmentHeight : segmentWidth,
@@ -3641,23 +3735,23 @@ var SegmentedVUMeterInner = ({
3641
3735
  segIdx
3642
3736
  );
3643
3737
  }) }),
3644
- orientation === "vertical" && /* @__PURE__ */ jsx36(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] })
3738
+ orientation === "vertical" && /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] })
3645
3739
  ] }, channelIndex);
3646
3740
  };
3647
3741
  const renderScale = () => {
3648
3742
  if (orientation === "horizontal") {
3649
3743
  const totalWidth = segmentCount * segmentTotalHeight - segmentGap;
3650
- return /* @__PURE__ */ jsxs12(HorizontalScaleWrapper, { children: [
3651
- /* @__PURE__ */ jsx36(ChannelLabel, { $labelColor: resolvedLabelColor, style: { visibility: "hidden" }, children: "L" }),
3652
- /* @__PURE__ */ jsx36(ScaleRow, { style: { width: `${totalWidth}px` }, children: scaleLabels.map(({ position, label }, i) => /* @__PURE__ */ jsx36(ScaleLabelHorizontal, { $left: position, $labelColor: resolvedLabelColor, children: label }, i)) })
3744
+ return /* @__PURE__ */ jsxs13(HorizontalScaleWrapper, { children: [
3745
+ /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, style: { visibility: "hidden" }, children: "L" }),
3746
+ /* @__PURE__ */ jsx40(ScaleRow, { style: { width: `${totalWidth}px` }, children: scaleLabels.map(({ position, label }, i) => /* @__PURE__ */ jsx40(ScaleLabelHorizontal, { $left: position, $labelColor: resolvedLabelColor, children: label }, i)) })
3653
3747
  ] });
3654
3748
  }
3655
3749
  const totalHeight = segmentCount * segmentTotalHeight - segmentGap;
3656
- return /* @__PURE__ */ jsx36(ScaleColumn, { style: { height: `${totalHeight}px` }, children: scaleLabels.map(({ position, label }, i) => /* @__PURE__ */ jsx36(ScaleLabel, { $top: position, $labelColor: resolvedLabelColor, children: label }, i)) });
3750
+ return /* @__PURE__ */ jsx40(ScaleColumn, { style: { height: `${totalHeight}px` }, children: scaleLabels.map(({ position, label }, i) => /* @__PURE__ */ jsx40(ScaleLabel, { $top: position, $labelColor: resolvedLabelColor, children: label }, i)) });
3657
3751
  };
3658
3752
  if (isMultiChannel) {
3659
3753
  if (orientation === "horizontal") {
3660
- return /* @__PURE__ */ jsxs12(
3754
+ return /* @__PURE__ */ jsxs13(
3661
3755
  MeterContainer,
3662
3756
  {
3663
3757
  className,
@@ -3673,7 +3767,7 @@ var SegmentedVUMeterInner = ({
3673
3767
  const midpoint = Math.ceil(channelCount / 2);
3674
3768
  const leftChannels = Array.from({ length: midpoint }, (_, i) => i);
3675
3769
  const rightChannels = Array.from({ length: channelCount - midpoint }, (_, i) => midpoint + i);
3676
- return /* @__PURE__ */ jsxs12(
3770
+ return /* @__PURE__ */ jsxs13(
3677
3771
  MeterContainer,
3678
3772
  {
3679
3773
  className,
@@ -3687,7 +3781,7 @@ var SegmentedVUMeterInner = ({
3687
3781
  }
3688
3782
  );
3689
3783
  }
3690
- return /* @__PURE__ */ jsxs12(
3784
+ return /* @__PURE__ */ jsxs13(
3691
3785
  MeterContainer,
3692
3786
  {
3693
3787
  className,
@@ -3752,11 +3846,14 @@ export {
3752
3846
  DevicePixelRatioProvider,
3753
3847
  DotsIcon,
3754
3848
  FadeOverlay,
3849
+ GripIcon,
3755
3850
  Header,
3756
3851
  InlineLabel,
3757
3852
  LoopRegion,
3758
3853
  LoopRegionMarkers,
3759
3854
  MasterVolumeControl,
3855
+ MoveDownIcon,
3856
+ MoveUpIcon,
3760
3857
  PianoRollChannel,
3761
3858
  Playhead,
3762
3859
  PlayheadWithMarker,
@@ -3764,6 +3861,7 @@ export {
3764
3861
  PlaylistErrorBoundary,
3765
3862
  PlaylistInfoContext,
3766
3863
  PlayoutProvider,
3864
+ ReorderRail,
3767
3865
  ScreenReaderOnly,
3768
3866
  ScrollViewportProvider,
3769
3867
  SegmentedVUMeter,