@waveform-playlist/ui-components 13.1.5 → 14.0.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
@@ -945,6 +945,7 @@ var PlaylistErrorBoundary = class extends React4.Component {
945
945
  // src/components/Clip.tsx
946
946
  import styled13 from "styled-components";
947
947
  import { useDraggable } from "@dnd-kit/react";
948
+ import { Feedback } from "@dnd-kit/dom";
948
949
 
949
950
  // src/components/ClipHeader.tsx
950
951
  import styled10 from "styled-components";
@@ -1144,6 +1145,8 @@ var FadeOverlay = ({
1144
1145
  // src/components/Clip.tsx
1145
1146
  import { clipPixelWidth } from "@waveform-playlist/core";
1146
1147
  import { Fragment, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
1148
+ var CLIP_MOVE_PLUGINS = [Feedback.configure({ dropAnimation: null })];
1149
+ var TRIM_HANDLE_PLUGINS = [Feedback.configure({ feedback: "none" })];
1147
1150
  var ClipContainer = styled13.div.attrs((props) => ({
1148
1151
  style: props.$isOverlay ? {} : {
1149
1152
  left: `${props.$left}px`,
@@ -1197,21 +1200,22 @@ var Clip = ({
1197
1200
  } = useDraggable({
1198
1201
  id: draggableId,
1199
1202
  data: { clipId, trackIndex, clipIndex, startSample, durationSamples },
1200
- disabled: !enableDrag
1203
+ disabled: !enableDrag,
1204
+ plugins: CLIP_MOVE_PLUGINS
1201
1205
  });
1202
1206
  const leftBoundaryId = `clip-boundary-left-${trackIndex}-${clipIndex}`;
1203
1207
  const { ref: leftBoundaryRef, isDragSource: isLeftBoundaryDragging } = useDraggable({
1204
1208
  id: leftBoundaryId,
1205
1209
  data: { clipId, trackIndex, clipIndex, boundary: "left", startSample, durationSamples },
1206
1210
  disabled: !enableDrag,
1207
- feedback: "none"
1211
+ plugins: TRIM_HANDLE_PLUGINS
1208
1212
  });
1209
1213
  const rightBoundaryId = `clip-boundary-right-${trackIndex}-${clipIndex}`;
1210
1214
  const { ref: rightBoundaryRef, isDragSource: isRightBoundaryDragging } = useDraggable({
1211
1215
  id: rightBoundaryId,
1212
1216
  data: { clipId, trackIndex, clipIndex, boundary: "right", startSample, durationSamples },
1213
1217
  disabled: !enableDrag,
1214
- feedback: "none"
1218
+ plugins: TRIM_HANDLE_PLUGINS
1215
1219
  });
1216
1220
  const style = isDragSource ? { zIndex: 100 } : void 0;
1217
1221
  return /* @__PURE__ */ jsxs2(
@@ -3226,9 +3230,103 @@ import { DotsThreeIcon } from "@phosphor-icons/react";
3226
3230
  import { jsx as jsx34 } from "react/jsx-runtime";
3227
3231
  var DotsIcon = (props) => /* @__PURE__ */ jsx34(DotsThreeIcon, { weight: "bold", ...props });
3228
3232
 
3229
- // src/components/TrackControls/Slider.tsx
3233
+ // src/components/TrackControls/GripIcon.tsx
3234
+ import { DotsSixVerticalIcon } from "@phosphor-icons/react";
3235
+ import { jsx as jsx35 } from "react/jsx-runtime";
3236
+ var GripIcon = (props) => /* @__PURE__ */ jsx35(DotsSixVerticalIcon, { weight: "bold", ...props });
3237
+
3238
+ // src/components/TrackControls/MoveUpIcon.tsx
3239
+ import { CaretUpIcon } from "@phosphor-icons/react";
3240
+ import { jsx as jsx36 } from "react/jsx-runtime";
3241
+ var MoveUpIcon = (props) => /* @__PURE__ */ jsx36(CaretUpIcon, { weight: "bold", ...props });
3242
+
3243
+ // src/components/TrackControls/MoveDownIcon.tsx
3244
+ import { CaretDownIcon } from "@phosphor-icons/react";
3245
+ import { jsx as jsx37 } from "react/jsx-runtime";
3246
+ var MoveDownIcon = (props) => /* @__PURE__ */ jsx37(CaretDownIcon, { weight: "bold", ...props });
3247
+
3248
+ // src/components/TrackControls/ReorderRail.tsx
3230
3249
  import styled31 from "styled-components";
3231
- var Slider = styled31(BaseSlider)`
3250
+ import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
3251
+ var Rail = styled31.div`
3252
+ display: flex;
3253
+ flex-direction: column;
3254
+ align-items: center;
3255
+ gap: 2px;
3256
+ color: ${(props) => props.theme.textColor};
3257
+ opacity: 0.55;
3258
+ transition: opacity 0.15s ease-in-out;
3259
+
3260
+ &:hover,
3261
+ &:focus-within {
3262
+ opacity: 1;
3263
+ }
3264
+ `;
3265
+ var RailButton = styled31.button.attrs({ type: "button" })`
3266
+ border: none;
3267
+ background: transparent;
3268
+ color: inherit;
3269
+ padding: 0;
3270
+ display: flex;
3271
+ align-items: center;
3272
+ justify-content: center;
3273
+ border-radius: ${(props) => props.theme.borderRadius};
3274
+
3275
+ &:focus-visible {
3276
+ outline: none;
3277
+ box-shadow: 0 0 0 0.2rem ${(props) => props.theme.inputFocusBorder}33;
3278
+ }
3279
+ `;
3280
+ var ChevronButton = styled31(RailButton)`
3281
+ width: 16px;
3282
+ height: 14px;
3283
+ cursor: pointer;
3284
+
3285
+ &:hover:not(:disabled) {
3286
+ background: ${(props) => props.theme.borderColor};
3287
+ }
3288
+
3289
+ &:disabled {
3290
+ opacity: 0.15;
3291
+ cursor: default;
3292
+ }
3293
+ `;
3294
+ var GripButton = styled31(RailButton)`
3295
+ width: 16px;
3296
+ height: 20px;
3297
+ cursor: grab;
3298
+ touch-action: none;
3299
+
3300
+ &:active {
3301
+ cursor: grabbing;
3302
+ }
3303
+ `;
3304
+ var ReorderRail = ({
3305
+ onMoveUp,
3306
+ onMoveDown,
3307
+ upDisabled = false,
3308
+ downDisabled = false,
3309
+ gripRef,
3310
+ onGripClick,
3311
+ style
3312
+ }) => /* @__PURE__ */ jsxs11(Rail, { style, children: [
3313
+ /* @__PURE__ */ jsx38(ChevronButton, { "aria-label": "Move track up", disabled: upDisabled, onClick: onMoveUp, children: /* @__PURE__ */ jsx38(MoveUpIcon, { size: 12 }) }),
3314
+ /* @__PURE__ */ jsx38(
3315
+ GripButton,
3316
+ {
3317
+ ref: gripRef,
3318
+ "aria-label": "Drag to reorder track",
3319
+ title: "Drag to reorder track",
3320
+ onClick: onGripClick,
3321
+ children: /* @__PURE__ */ jsx38(GripIcon, { size: 14 })
3322
+ }
3323
+ ),
3324
+ /* @__PURE__ */ jsx38(ChevronButton, { "aria-label": "Move track down", disabled: downDisabled, onClick: onMoveDown, children: /* @__PURE__ */ jsx38(MoveDownIcon, { size: 12 }) })
3325
+ ] });
3326
+
3327
+ // src/components/TrackControls/Slider.tsx
3328
+ import styled32 from "styled-components";
3329
+ var Slider = styled32(BaseSlider)`
3232
3330
  width: 75%;
3233
3331
  height: 5px;
3234
3332
  background: ${(props) => props.theme.sliderTrackColor};
@@ -3280,8 +3378,8 @@ var Slider = styled31(BaseSlider)`
3280
3378
  `;
3281
3379
 
3282
3380
  // src/components/TrackControls/SliderWrapper.tsx
3283
- import styled32 from "styled-components";
3284
- var SliderWrapper = styled32.label`
3381
+ import styled33 from "styled-components";
3382
+ var SliderWrapper = styled33.label`
3285
3383
  width: 100%;
3286
3384
  display: flex;
3287
3385
  justify-content: space-between;
@@ -3294,13 +3392,13 @@ var SliderWrapper = styled32.label`
3294
3392
  // src/components/TrackMenu.tsx
3295
3393
  import React20, { useState as useState6, useEffect as useEffect7, useRef as useRef9, useCallback as useCallback5 } from "react";
3296
3394
  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`
3395
+ import styled34 from "styled-components";
3396
+ import { jsx as jsx39, jsxs as jsxs12 } from "react/jsx-runtime";
3397
+ var MenuContainer = styled34.div`
3300
3398
  position: relative;
3301
3399
  display: inline-block;
3302
3400
  `;
3303
- var MenuButton = styled33.button`
3401
+ var MenuButton = styled34.button`
3304
3402
  background: none;
3305
3403
  border: none;
3306
3404
  cursor: pointer;
@@ -3316,7 +3414,7 @@ var MenuButton = styled33.button`
3316
3414
  }
3317
3415
  `;
3318
3416
  var DROPDOWN_MIN_WIDTH = 180;
3319
- var Dropdown = styled33.div`
3417
+ var Dropdown = styled34.div`
3320
3418
  position: fixed;
3321
3419
  top: ${(p) => p.$top}px;
3322
3420
  left: ${(p) => p.$left}px;
@@ -3329,7 +3427,7 @@ var Dropdown = styled33.div`
3329
3427
  min-width: ${DROPDOWN_MIN_WIDTH}px;
3330
3428
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
3331
3429
  `;
3332
- var Divider = styled33.hr`
3430
+ var Divider = styled34.hr`
3333
3431
  border: none;
3334
3432
  border-top: 1px solid rgba(128, 128, 128, 0.3);
3335
3433
  margin: 0.35rem 0;
@@ -3392,8 +3490,8 @@ var TrackMenu = ({ items: itemsProp }) => {
3392
3490
  document.removeEventListener("keydown", handleKeyDown);
3393
3491
  };
3394
3492
  }, [open]);
3395
- return /* @__PURE__ */ jsxs11(MenuContainer, { children: [
3396
- /* @__PURE__ */ jsx35(
3493
+ return /* @__PURE__ */ jsxs12(MenuContainer, { children: [
3494
+ /* @__PURE__ */ jsx39(
3397
3495
  MenuButton,
3398
3496
  {
3399
3497
  ref: buttonRef,
@@ -3404,19 +3502,19 @@ var TrackMenu = ({ items: itemsProp }) => {
3404
3502
  onMouseDown: (e) => e.stopPropagation(),
3405
3503
  title: "Track menu",
3406
3504
  "aria-label": "Track menu",
3407
- children: /* @__PURE__ */ jsx35(DotsIcon, { size: 16 })
3505
+ children: /* @__PURE__ */ jsx39(DotsIcon, { size: 16 })
3408
3506
  }
3409
3507
  ),
3410
3508
  open && typeof document !== "undefined" && createPortal(
3411
- /* @__PURE__ */ jsx35(
3509
+ /* @__PURE__ */ jsx39(
3412
3510
  Dropdown,
3413
3511
  {
3414
3512
  ref: dropdownRef,
3415
3513
  $top: dropdownPos.top,
3416
3514
  $left: dropdownPos.left,
3417
3515
  onMouseDown: (e) => e.stopPropagation(),
3418
- children: items.map((item, index) => /* @__PURE__ */ jsxs11(React20.Fragment, { children: [
3419
- index > 0 && /* @__PURE__ */ jsx35(Divider, {}),
3516
+ children: items.map((item, index) => /* @__PURE__ */ jsxs12(React20.Fragment, { children: [
3517
+ index > 0 && /* @__PURE__ */ jsx39(Divider, {}),
3420
3518
  item.content
3421
3519
  ] }, item.id))
3422
3520
  }
@@ -3428,9 +3526,9 @@ var TrackMenu = ({ items: itemsProp }) => {
3428
3526
 
3429
3527
  // src/components/SegmentedVUMeter.tsx
3430
3528
  import React21, { useMemo as useMemo5 } from "react";
3431
- import styled34 from "styled-components";
3529
+ import styled35 from "styled-components";
3432
3530
  import { normalizedToDb } from "@waveform-playlist/core";
3433
- import { jsx as jsx36, jsxs as jsxs12 } from "react/jsx-runtime";
3531
+ import { jsx as jsx40, jsxs as jsxs13 } from "react/jsx-runtime";
3434
3532
  var DEFAULT_COLOR_STOPS = [
3435
3533
  { dB: 2, color: "#ff0000" },
3436
3534
  { dB: -1, color: "#e74c3c" },
@@ -3467,23 +3565,23 @@ function computeThresholds(segmentCount, dBRange) {
3467
3565
  function formatDbLabel(dB) {
3468
3566
  return Math.round(dB).toString();
3469
3567
  }
3470
- var MeterContainer = styled34.div`
3568
+ var MeterContainer = styled35.div`
3471
3569
  display: inline-flex;
3472
3570
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "column" : "row"};
3473
3571
  gap: 4px;
3474
3572
  font-family: 'Courier New', monospace;
3475
3573
  `;
3476
- var ChannelColumn = styled34.div`
3574
+ var ChannelColumn = styled35.div`
3477
3575
  display: flex;
3478
3576
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "row" : "column"};
3479
3577
  align-items: center;
3480
3578
  gap: 4px;
3481
3579
  `;
3482
- var SegmentStack = styled34.div`
3580
+ var SegmentStack = styled35.div`
3483
3581
  display: flex;
3484
3582
  flex-direction: ${(props) => props.$orientation === "horizontal" ? "row" : "column"};
3485
3583
  `;
3486
- var Segment = styled34.div.attrs((props) => ({
3584
+ var Segment = styled35.div.attrs((props) => ({
3487
3585
  style: {
3488
3586
  width: `${props.$width}px`,
3489
3587
  height: `${props.$height}px`,
@@ -3496,19 +3594,19 @@ var Segment = styled34.div.attrs((props) => ({
3496
3594
  border-radius: 1px;
3497
3595
  `;
3498
3596
  var DEFAULT_LABEL_COLOR = "#888";
3499
- var ChannelLabel = styled34.div`
3597
+ var ChannelLabel = styled35.div`
3500
3598
  color: ${(props) => props.$labelColor};
3501
3599
  font-size: 10px;
3502
3600
  text-align: center;
3503
3601
  user-select: none;
3504
3602
  `;
3505
- var ScaleColumn = styled34.div`
3603
+ var ScaleColumn = styled35.div`
3506
3604
  display: flex;
3507
3605
  flex-direction: column;
3508
3606
  position: relative;
3509
3607
  min-width: 28px;
3510
3608
  `;
3511
- var ScaleLabel = styled34.div.attrs((props) => ({
3609
+ var ScaleLabel = styled35.div.attrs((props) => ({
3512
3610
  style: {
3513
3611
  top: `${props.$top}px`,
3514
3612
  color: props.$labelColor
@@ -3522,19 +3620,19 @@ var ScaleLabel = styled34.div.attrs((props) => ({
3522
3620
  transform: translate(-50%, -50%);
3523
3621
  user-select: none;
3524
3622
  `;
3525
- var HorizontalScaleWrapper = styled34.div`
3623
+ var HorizontalScaleWrapper = styled35.div`
3526
3624
  display: flex;
3527
3625
  flex-direction: row;
3528
3626
  align-items: center;
3529
3627
  gap: 4px;
3530
3628
  `;
3531
- var ScaleRow = styled34.div`
3629
+ var ScaleRow = styled35.div`
3532
3630
  display: flex;
3533
3631
  flex-direction: row;
3534
3632
  position: relative;
3535
3633
  min-height: 16px;
3536
3634
  `;
3537
- var ScaleLabelHorizontal = styled34.div.attrs((props) => ({
3635
+ var ScaleLabelHorizontal = styled35.div.attrs((props) => ({
3538
3636
  style: {
3539
3637
  left: `${props.$left}px`,
3540
3638
  color: props.$labelColor
@@ -3618,13 +3716,13 @@ var SegmentedVUMeterInner = ({
3618
3716
  }
3619
3717
  }
3620
3718
  }
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) => {
3719
+ return /* @__PURE__ */ jsxs13(ChannelColumn, { $orientation: orientation, "data-channel": true, children: [
3720
+ orientation === "horizontal" && /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] }),
3721
+ /* @__PURE__ */ jsx40(SegmentStack, { $orientation: orientation, children: renderThresholds.map((threshold, segIdx) => {
3624
3722
  const active = levelDb >= threshold;
3625
3723
  const isPeak = segIdx === peakSegmentIndex;
3626
3724
  const color = getColorForDb(threshold, colorStops);
3627
- return /* @__PURE__ */ jsx36(
3725
+ return /* @__PURE__ */ jsx40(
3628
3726
  Segment,
3629
3727
  {
3630
3728
  $width: orientation === "horizontal" ? segmentHeight : segmentWidth,
@@ -3641,23 +3739,23 @@ var SegmentedVUMeterInner = ({
3641
3739
  segIdx
3642
3740
  );
3643
3741
  }) }),
3644
- orientation === "vertical" && /* @__PURE__ */ jsx36(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] })
3742
+ orientation === "vertical" && /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, children: labels[channelIndex] })
3645
3743
  ] }, channelIndex);
3646
3744
  };
3647
3745
  const renderScale = () => {
3648
3746
  if (orientation === "horizontal") {
3649
3747
  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)) })
3748
+ return /* @__PURE__ */ jsxs13(HorizontalScaleWrapper, { children: [
3749
+ /* @__PURE__ */ jsx40(ChannelLabel, { $labelColor: resolvedLabelColor, style: { visibility: "hidden" }, children: "L" }),
3750
+ /* @__PURE__ */ jsx40(ScaleRow, { style: { width: `${totalWidth}px` }, children: scaleLabels.map(({ position, label }, i) => /* @__PURE__ */ jsx40(ScaleLabelHorizontal, { $left: position, $labelColor: resolvedLabelColor, children: label }, i)) })
3653
3751
  ] });
3654
3752
  }
3655
3753
  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)) });
3754
+ 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
3755
  };
3658
3756
  if (isMultiChannel) {
3659
3757
  if (orientation === "horizontal") {
3660
- return /* @__PURE__ */ jsxs12(
3758
+ return /* @__PURE__ */ jsxs13(
3661
3759
  MeterContainer,
3662
3760
  {
3663
3761
  className,
@@ -3673,7 +3771,7 @@ var SegmentedVUMeterInner = ({
3673
3771
  const midpoint = Math.ceil(channelCount / 2);
3674
3772
  const leftChannels = Array.from({ length: midpoint }, (_, i) => i);
3675
3773
  const rightChannels = Array.from({ length: channelCount - midpoint }, (_, i) => midpoint + i);
3676
- return /* @__PURE__ */ jsxs12(
3774
+ return /* @__PURE__ */ jsxs13(
3677
3775
  MeterContainer,
3678
3776
  {
3679
3777
  className,
@@ -3687,7 +3785,7 @@ var SegmentedVUMeterInner = ({
3687
3785
  }
3688
3786
  );
3689
3787
  }
3690
- return /* @__PURE__ */ jsxs12(
3788
+ return /* @__PURE__ */ jsxs13(
3691
3789
  MeterContainer,
3692
3790
  {
3693
3791
  className,
@@ -3752,11 +3850,14 @@ export {
3752
3850
  DevicePixelRatioProvider,
3753
3851
  DotsIcon,
3754
3852
  FadeOverlay,
3853
+ GripIcon,
3755
3854
  Header,
3756
3855
  InlineLabel,
3757
3856
  LoopRegion,
3758
3857
  LoopRegionMarkers,
3759
3858
  MasterVolumeControl,
3859
+ MoveDownIcon,
3860
+ MoveUpIcon,
3760
3861
  PianoRollChannel,
3761
3862
  Playhead,
3762
3863
  PlayheadWithMarker,
@@ -3764,6 +3865,7 @@ export {
3764
3865
  PlaylistErrorBoundary,
3765
3866
  PlaylistInfoContext,
3766
3867
  PlayoutProvider,
3868
+ ReorderRail,
3767
3869
  ScreenReaderOnly,
3768
3870
  ScrollViewportProvider,
3769
3871
  SegmentedVUMeter,