@waveform-playlist/ui-components 8.0.0 → 9.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
@@ -840,8 +840,7 @@ var PlaylistErrorBoundary = class extends React4.Component {
840
840
 
841
841
  // src/components/Clip.tsx
842
842
  import styled13 from "styled-components";
843
- import { useDraggable } from "@dnd-kit/core";
844
- import { CSS } from "@dnd-kit/utilities";
843
+ import { useDraggable } from "@dnd-kit/react";
845
844
 
846
845
  // src/components/ClipHeader.tsx
847
846
  import styled10 from "styled-components";
@@ -855,7 +854,7 @@ var HeaderContainer = styled10.div`
855
854
  display: flex;
856
855
  align-items: center;
857
856
  padding: 0 8px;
858
- cursor: ${(props) => props.$interactive ? props.$isDragging ? "grabbing" : "grab" : "default"};
857
+ cursor: ${(props) => props.$interactive ? "grab" : "default"};
859
858
  user-select: none;
860
859
  z-index: 110;
861
860
  flex-shrink: 0;
@@ -885,7 +884,7 @@ var ClipHeaderPresentational = ({
885
884
  trackName,
886
885
  isSelected = false
887
886
  }) => {
888
- return /* @__PURE__ */ jsx7(HeaderContainer, { $isDragging: false, $interactive: false, $isSelected: isSelected, children: /* @__PURE__ */ jsx7(TrackName, { children: trackName }) });
887
+ return /* @__PURE__ */ jsx7(HeaderContainer, { $interactive: false, $isSelected: isSelected, children: /* @__PURE__ */ jsx7(TrackName, { children: trackName }) });
889
888
  };
890
889
  var ClipHeader = ({
891
890
  clipId,
@@ -899,16 +898,14 @@ var ClipHeader = ({
899
898
  if (disableDrag || !dragHandleProps) {
900
899
  return /* @__PURE__ */ jsx7(ClipHeaderPresentational, { trackName, isSelected });
901
900
  }
902
- const { attributes, listeners, setActivatorNodeRef } = dragHandleProps;
901
+ const { handleRef } = dragHandleProps;
903
902
  return /* @__PURE__ */ jsx7(
904
903
  HeaderContainer,
905
904
  {
906
- ref: setActivatorNodeRef,
905
+ ref: handleRef,
907
906
  "data-clip-id": clipId,
908
907
  $interactive: true,
909
908
  $isSelected: isSelected,
910
- ...listeners,
911
- ...attributes,
912
909
  children: /* @__PURE__ */ jsx7(TrackName, { children: trackName })
913
910
  }
914
911
  );
@@ -961,11 +958,11 @@ var ClipBoundary = ({
961
958
  if (!dragHandleProps) {
962
959
  return null;
963
960
  }
964
- const { attributes, listeners, setActivatorNodeRef, isDragging } = dragHandleProps;
961
+ const { ref: boundaryRef, isDragging } = dragHandleProps;
965
962
  return /* @__PURE__ */ jsx8(
966
963
  BoundaryContainer,
967
964
  {
968
- ref: setActivatorNodeRef,
965
+ ref: boundaryRef,
969
966
  "data-clip-id": clipId,
970
967
  "data-boundary-edge": edge,
971
968
  $edge: edge,
@@ -973,9 +970,7 @@ var ClipBoundary = ({
973
970
  $isHovered: isHovered,
974
971
  $touchOptimized: touchOptimized,
975
972
  onMouseEnter: () => setIsHovered(true),
976
- onMouseLeave: () => setIsHovered(false),
977
- ...listeners,
978
- ...attributes
973
+ onMouseLeave: () => setIsHovered(false)
979
974
  }
980
975
  );
981
976
  };
@@ -1096,42 +1091,34 @@ var Clip = ({
1096
1091
  const width = endPixel - left;
1097
1092
  const enableDrag = showHeader && !disableHeaderDrag && !isOverlay;
1098
1093
  const draggableId = `clip-${trackIndex}-${clipIndex}`;
1099
- const { attributes, listeners, setNodeRef, setActivatorNodeRef, transform, isDragging } = useDraggable({
1094
+ const {
1095
+ ref: clipRef,
1096
+ handleRef,
1097
+ isDragSource
1098
+ } = useDraggable({
1100
1099
  id: draggableId,
1101
1100
  data: { clipId, trackIndex, clipIndex },
1102
1101
  disabled: !enableDrag
1103
1102
  });
1104
1103
  const leftBoundaryId = `clip-boundary-left-${trackIndex}-${clipIndex}`;
1105
- const {
1106
- attributes: leftBoundaryAttributes,
1107
- listeners: leftBoundaryListeners,
1108
- setActivatorNodeRef: setLeftBoundaryActivatorRef,
1109
- isDragging: isLeftBoundaryDragging
1110
- } = useDraggable({
1104
+ const { ref: leftBoundaryRef, isDragSource: isLeftBoundaryDragging } = useDraggable({
1111
1105
  id: leftBoundaryId,
1112
1106
  data: { clipId, trackIndex, clipIndex, boundary: "left" },
1113
- disabled: !enableDrag
1107
+ disabled: !enableDrag,
1108
+ feedback: "none"
1114
1109
  });
1115
1110
  const rightBoundaryId = `clip-boundary-right-${trackIndex}-${clipIndex}`;
1116
- const {
1117
- attributes: rightBoundaryAttributes,
1118
- listeners: rightBoundaryListeners,
1119
- setActivatorNodeRef: setRightBoundaryActivatorRef,
1120
- isDragging: isRightBoundaryDragging
1121
- } = useDraggable({
1111
+ const { ref: rightBoundaryRef, isDragSource: isRightBoundaryDragging } = useDraggable({
1122
1112
  id: rightBoundaryId,
1123
1113
  data: { clipId, trackIndex, clipIndex, boundary: "right" },
1124
- disabled: !enableDrag
1114
+ disabled: !enableDrag,
1115
+ feedback: "none"
1125
1116
  });
1126
- const style = transform ? {
1127
- transform: CSS.Translate.toString(transform),
1128
- zIndex: isDragging ? 100 : void 0
1129
- // Below controls (z-index: 999) but above other clips
1130
- } : void 0;
1117
+ const style = isDragSource ? { zIndex: 100 } : void 0;
1131
1118
  return /* @__PURE__ */ jsxs2(
1132
1119
  ClipContainer,
1133
1120
  {
1134
- ref: setNodeRef,
1121
+ ref: clipRef,
1135
1122
  style,
1136
1123
  className,
1137
1124
  $left: left,
@@ -1150,7 +1137,7 @@ var Clip = ({
1150
1137
  trackName,
1151
1138
  isSelected,
1152
1139
  disableDrag: disableHeaderDrag,
1153
- dragHandleProps: enableDrag ? { attributes, listeners, setActivatorNodeRef } : void 0
1140
+ dragHandleProps: enableDrag ? { handleRef } : void 0
1154
1141
  }
1155
1142
  ),
1156
1143
  /* @__PURE__ */ jsx10(ClipViewportOriginProvider, { originX: left, children: /* @__PURE__ */ jsxs2(ChannelsWrapper, { $isOverlay: isOverlay, children: [
@@ -1184,9 +1171,7 @@ var Clip = ({
1184
1171
  edge: "left",
1185
1172
  touchOptimized,
1186
1173
  dragHandleProps: {
1187
- attributes: leftBoundaryAttributes,
1188
- listeners: leftBoundaryListeners,
1189
- setActivatorNodeRef: setLeftBoundaryActivatorRef,
1174
+ ref: leftBoundaryRef,
1190
1175
  isDragging: isLeftBoundaryDragging
1191
1176
  }
1192
1177
  }
@@ -1200,9 +1185,7 @@ var Clip = ({
1200
1185
  edge: "right",
1201
1186
  touchOptimized,
1202
1187
  dragHandleProps: {
1203
- attributes: rightBoundaryAttributes,
1204
- listeners: rightBoundaryListeners,
1205
- setActivatorNodeRef: setRightBoundaryActivatorRef,
1188
+ ref: rightBoundaryRef,
1206
1189
  isDragging: isRightBoundaryDragging
1207
1190
  }
1208
1191
  }
@@ -1311,7 +1294,8 @@ var PlayheadWithMarker = ({
1311
1294
  samplesPerPixel,
1312
1295
  sampleRate,
1313
1296
  controlsOffset,
1314
- getAudioContextTime
1297
+ getAudioContextTime,
1298
+ getPlaybackTime
1315
1299
  }) => {
1316
1300
  const containerRef = useRef3(null);
1317
1301
  const animationFrameRef = useRef3(null);
@@ -1319,9 +1303,15 @@ var PlayheadWithMarker = ({
1319
1303
  const updatePosition = () => {
1320
1304
  if (containerRef.current) {
1321
1305
  let time;
1322
- if (isPlaying && getAudioContextTime) {
1323
- const elapsed = getAudioContextTime() - (playbackStartTimeRef.current ?? 0);
1324
- time = (audioStartPositionRef.current ?? 0) + elapsed;
1306
+ if (isPlaying) {
1307
+ if (getPlaybackTime) {
1308
+ time = getPlaybackTime();
1309
+ } else if (getAudioContextTime) {
1310
+ const elapsed = getAudioContextTime() - (playbackStartTimeRef.current ?? 0);
1311
+ time = (audioStartPositionRef.current ?? 0) + elapsed;
1312
+ } else {
1313
+ time = currentTimeRef.current ?? 0;
1314
+ }
1325
1315
  } else {
1326
1316
  time = currentTimeRef.current ?? 0;
1327
1317
  }
@@ -1351,7 +1341,8 @@ var PlayheadWithMarker = ({
1351
1341
  currentTimeRef,
1352
1342
  playbackStartTimeRef,
1353
1343
  audioStartPositionRef,
1354
- getAudioContextTime
1344
+ getAudioContextTime,
1345
+ getPlaybackTime
1355
1346
  ]);
1356
1347
  useEffect3(() => {
1357
1348
  if (!isPlaying && containerRef.current) {