box-content-preview 3.106.0 → 3.107.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 +7 -7
- package/dist/lib/index.css +69 -69
- package/dist/lib/index.js +196 -36
- package/package.json +19 -21
package/dist/lib/index.js
CHANGED
|
@@ -1032,7 +1032,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1032
1032
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
1033
1033
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
1034
1034
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
1035
|
-
const CLIENT_VERSION = "3.
|
|
1035
|
+
const CLIENT_VERSION = "3.107.0"; // eslint-disable-line no-undef
|
|
1036
1036
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
1037
1037
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
1038
1038
|
const PROMISE_MAP = {};
|
|
@@ -6185,6 +6185,14 @@ function devicePixelWidth(widthCssPx) {
|
|
|
6185
6185
|
const pixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1;
|
|
6186
6186
|
return widthCssPx * pixelRatio;
|
|
6187
6187
|
}
|
|
6188
|
+
|
|
6189
|
+
/** Dragged time while media is still at the pre-drag position. */
|
|
6190
|
+
function pinnedPlayheadSec(pin, mediaTimeSec) {
|
|
6191
|
+
if (pin && Math.abs(mediaTimeSec - pin.fromSec) <= 0.001 && Math.abs(mediaTimeSec - pin.sec) > 0.001) {
|
|
6192
|
+
return pin.sec;
|
|
6193
|
+
}
|
|
6194
|
+
return null;
|
|
6195
|
+
}
|
|
6188
6196
|
function WaveformView_prefersReducedMotion() {
|
|
6189
6197
|
return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
6190
6198
|
}
|
|
@@ -6343,9 +6351,9 @@ function WaveformView({
|
|
|
6343
6351
|
const containerRef = (0,external_react_.useRef)(null); // WaveSurfer canvas host
|
|
6344
6352
|
const playheadAnimationRef = (0,external_react_.useRef)(0); // animation frame id while the playhead follows playback
|
|
6345
6353
|
const playheadRef = (0,external_react_.useRef)(null); // playhead element the camera positions
|
|
6354
|
+
const rangeLayerRef = (0,external_react_.useRef)(null);
|
|
6346
6355
|
const trackRef = (0,external_react_.useRef)(null); // hover / tap target around the canvas
|
|
6347
6356
|
const wavesurferRef = (0,external_react_.useRef)(null); // WaveSurfer instance
|
|
6348
|
-
const rangeLayerRef = (0,external_react_.useRef)(null);
|
|
6349
6357
|
|
|
6350
6358
|
// Latest props for WaveSurfer + media listeners that must not re-subscribe each render.
|
|
6351
6359
|
const cameraModeRef = (0,external_react_.useRef)(cameraMode); // latest tape/desktop; WaveSurfer create() deps stay empty
|
|
@@ -6356,10 +6364,10 @@ function WaveformView({
|
|
|
6356
6364
|
const isPlayingRef = (0,external_react_.useRef)(isPlaying); // latest isPlaying; tape tap toggles from this
|
|
6357
6365
|
const mediaElRef = (0,external_react_.useRef)(mediaEl); // latest <audio>/<video>; camera + playhead tick read this
|
|
6358
6366
|
const onPlayPauseRef = (0,external_react_.useRef)(onPlayPause); // latest play/pause; tape tap must not re-bind
|
|
6359
|
-
const onSeekRef = (0,external_react_.useRef)(onSeek); // latest onSeek; click/scroll handlers must not re-bind
|
|
6360
6367
|
const onRangeChangeRef = (0,external_react_.useRef)(onRangeChange); // latest range commit; drag-create must not re-bind
|
|
6361
6368
|
const onRangeClearRef = (0,external_react_.useRef)(onRangeClear); // latest click-outside clear; WaveSurfer click must not re-bind
|
|
6362
6369
|
const onRangeDragChangeRef = (0,external_react_.useRef)(onRangeDragChange); // latest drag flag; unmount must not re-bind
|
|
6370
|
+
const onSeekRef = (0,external_react_.useRef)(onSeek); // latest onSeek; click/scroll handlers must not re-bind
|
|
6363
6371
|
const onViewportChangeRef = (0,external_react_.useRef)(onViewportChange); // latest viewport callback; camera commits here
|
|
6364
6372
|
const peaksRef = (0,external_react_.useRef)(peaks); // latest peaks; WaveSurfer create() + morph read this
|
|
6365
6373
|
|
|
@@ -6370,9 +6378,12 @@ function WaveformView({
|
|
|
6370
6378
|
const bufferProgressRef = (0,external_react_.useRef)(0); // latest buffer fill; zoomed tile tint reads this
|
|
6371
6379
|
const hideScrubTimeChipTimerRef = (0,external_react_.useRef)(0); // hides the tape scrub time chip after scroll settles
|
|
6372
6380
|
const hoverProgressRef = (0,external_react_.useRef)(null); // latest hover fill; zoomed tile tint reads this
|
|
6381
|
+
const isPlayheadDraggingRef = (0,external_react_.useRef)(false); // playhead drag owns position until pointerup
|
|
6373
6382
|
const lastObservedWidthRef = (0,external_react_.useRef)(0); // last ResizeObserver width; skip no-op resizes
|
|
6374
6383
|
const liveHeightRef = (0,external_react_.useRef)(height); // canvas height last applied to WaveSurfer
|
|
6375
6384
|
const pinchStartRef = (0,external_react_.useRef)(null); // two-finger distance and zoom at pinch start
|
|
6385
|
+
const playheadDragRef = (0,external_react_.useRef)(null); // active playhead drag; pointerup seeks
|
|
6386
|
+
const playheadPinRef = (0,external_react_.useRef)(null); // dragged time until media/props catch up
|
|
6376
6387
|
const pointerZoomClearTimerRef = (0,external_react_.useRef)(0); // clears pointerZoomRef after WAVEFORM_ZOOM_DISMISS_MS
|
|
6377
6388
|
const pointerZoomRef = (0,external_react_.useRef)(false); // pinch/wheel in progress; skip play/pause and tape recenter
|
|
6378
6389
|
const queuedTapeSeekTimeSecRef = (0,external_react_.useRef)(null); // seek time waiting for the next animation frame
|
|
@@ -6385,16 +6396,18 @@ function WaveformView({
|
|
|
6385
6396
|
const zoomOriginRef = (0,external_react_.useRef)(null); // pointer+time so zoom keeps that point fixed
|
|
6386
6397
|
|
|
6387
6398
|
cameraModeRef.current = cameraMode;
|
|
6388
|
-
|
|
6399
|
+
if (!isPlayheadDraggingRef.current && playheadPinRef.current == null) {
|
|
6400
|
+
currentTimeRef.current = currentTime;
|
|
6401
|
+
}
|
|
6389
6402
|
durationSecRef.current = durationSec;
|
|
6390
6403
|
interactiveRef.current = interactive;
|
|
6391
6404
|
isPlayingRef.current = isPlaying;
|
|
6392
6405
|
mediaElRef.current = mediaEl;
|
|
6393
6406
|
onPlayPauseRef.current = onPlayPause;
|
|
6394
|
-
onSeekRef.current = onSeek;
|
|
6395
6407
|
onRangeChangeRef.current = onRangeChange;
|
|
6396
6408
|
onRangeClearRef.current = onRangeClear;
|
|
6397
6409
|
onRangeDragChangeRef.current = onRangeDragChange;
|
|
6410
|
+
onSeekRef.current = onSeek;
|
|
6398
6411
|
onViewportChangeRef.current = onViewportChange;
|
|
6399
6412
|
peaksRef.current = peaks;
|
|
6400
6413
|
const [internalZoom, setInternalZoom] = (0,external_react_.useState)(constants/* WAVEFORM_ZOOM_MIN */.LW);
|
|
@@ -6406,15 +6419,16 @@ function WaveformView({
|
|
|
6406
6419
|
const [previewRange, setPreviewRange] = (0,external_react_.useState)(null);
|
|
6407
6420
|
const [createRange, setCreateRange] = (0,external_react_.useState)(null);
|
|
6408
6421
|
const [isRangeDragging, setIsRangeDragging] = (0,external_react_.useState)(false);
|
|
6409
|
-
const
|
|
6410
|
-
const rangeRef = (0,external_react_.useRef)(range); // latest committed draft; drag-create must not start on top of an open span
|
|
6422
|
+
const [isPlayheadDragging, setIsPlayheadDragging] = (0,external_react_.useState)(false);
|
|
6411
6423
|
const createDragRef = (0,external_react_.useRef)(null);
|
|
6412
|
-
const
|
|
6424
|
+
const isRangeDraggingRef = (0,external_react_.useRef)(false);
|
|
6425
|
+
const lastSetTimeSecRef = (0,external_react_.useRef)(null);
|
|
6413
6426
|
const rangeDragPointerXRef = (0,external_react_.useRef)(null); // clientX while a handle or create-drag is down
|
|
6427
|
+
const rangeRef = (0,external_react_.useRef)(range); // latest committed draft; drag-create must not start on top of an open span
|
|
6414
6428
|
const removeCreateDragListenersRef = (0,external_react_.useRef)(null);
|
|
6415
6429
|
const removeTapeContextMenuRef = (0,external_react_.useRef)(null);
|
|
6416
6430
|
const skipNextSeekRef = (0,external_react_.useRef)(false); // ignore the click fired when a handle is released
|
|
6417
|
-
const
|
|
6431
|
+
const tapeRangeHoldRef = (0,external_react_.useRef)(false); // a tape long-press is waiting to draw; touch must not scroll
|
|
6418
6432
|
const [isRangeHovered, setIsRangeHovered] = (0,external_react_.useState)(false);
|
|
6419
6433
|
const isControlled = typeof zoomLevelProp === 'number';
|
|
6420
6434
|
const maxZoom = (0,waveform_viewport/* getWaveformZoomMax */.by)({
|
|
@@ -6849,7 +6863,17 @@ function WaveformView({
|
|
|
6849
6863
|
applyZoomWindow();
|
|
6850
6864
|
}, [applyZoomWindow]);
|
|
6851
6865
|
(0,external_react_.useLayoutEffect)(() => {
|
|
6852
|
-
|
|
6866
|
+
if (isPlayheadDraggingRef.current) {
|
|
6867
|
+
return;
|
|
6868
|
+
}
|
|
6869
|
+
const mediaTimeSec = mediaEl ? mediaEl.currentTime : currentTime;
|
|
6870
|
+
const draggedTimeSec = pinnedPlayheadSec(playheadPinRef.current, mediaTimeSec);
|
|
6871
|
+
if (draggedTimeSec != null) {
|
|
6872
|
+
updatePlayheadPosition(draggedTimeSec);
|
|
6873
|
+
return;
|
|
6874
|
+
}
|
|
6875
|
+
playheadPinRef.current = null;
|
|
6876
|
+
updatePlayheadPosition(mediaTimeSec);
|
|
6853
6877
|
}, [currentTime, durationSec, mediaEl, updatePlayheadPosition, viewport]);
|
|
6854
6878
|
(0,external_react_.useEffect)(() => {
|
|
6855
6879
|
const media = mediaEl;
|
|
@@ -6857,10 +6881,15 @@ function WaveformView({
|
|
|
6857
6881
|
return undefined;
|
|
6858
6882
|
}
|
|
6859
6883
|
const tick = () => {
|
|
6860
|
-
if (!media.paused) {
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6884
|
+
if (!media.paused && !isPlayheadDraggingRef.current) {
|
|
6885
|
+
const mediaTimeSec = media.currentTime;
|
|
6886
|
+
const draggedTimeSec = pinnedPlayheadSec(playheadPinRef.current, mediaTimeSec);
|
|
6887
|
+
if (draggedTimeSec == null) {
|
|
6888
|
+
playheadPinRef.current = null;
|
|
6889
|
+
}
|
|
6890
|
+
updatePlayheadPosition(draggedTimeSec ?? mediaTimeSec);
|
|
6891
|
+
if (draggedTimeSec == null && !isRangeDraggingRef.current) {
|
|
6892
|
+
applyPlayheadCamera(mediaTimeSec, false);
|
|
6864
6893
|
}
|
|
6865
6894
|
}
|
|
6866
6895
|
playheadAnimationRef.current = window.requestAnimationFrame(tick);
|
|
@@ -6868,7 +6897,7 @@ function WaveformView({
|
|
|
6868
6897
|
const startLoop = () => {
|
|
6869
6898
|
window.cancelAnimationFrame(playheadAnimationRef.current);
|
|
6870
6899
|
releaseUserPanHold();
|
|
6871
|
-
if (!isRangeDraggingRef.current) {
|
|
6900
|
+
if (!isRangeDraggingRef.current && !isPlayheadDraggingRef.current) {
|
|
6872
6901
|
applyPlayheadCamera(media.currentTime, true);
|
|
6873
6902
|
}
|
|
6874
6903
|
playheadAnimationRef.current = window.requestAnimationFrame(tick);
|
|
@@ -6881,9 +6910,15 @@ function WaveformView({
|
|
|
6881
6910
|
clearFollowPin();
|
|
6882
6911
|
}
|
|
6883
6912
|
syncViewport();
|
|
6884
|
-
|
|
6913
|
+
if (!isPlayheadDraggingRef.current) {
|
|
6914
|
+
updatePlayheadPosition(media.currentTime);
|
|
6915
|
+
}
|
|
6885
6916
|
};
|
|
6886
6917
|
const handleSeeked = () => {
|
|
6918
|
+
if (isPlayheadDraggingRef.current) {
|
|
6919
|
+
return;
|
|
6920
|
+
}
|
|
6921
|
+
playheadPinRef.current = null;
|
|
6887
6922
|
onPlayheadSeek(media.currentTime);
|
|
6888
6923
|
if (!isUserPanning() && !isRangeDraggingRef.current) {
|
|
6889
6924
|
seekTo(media.currentTime);
|
|
@@ -6947,15 +6982,19 @@ function WaveformView({
|
|
|
6947
6982
|
});
|
|
6948
6983
|
if (isScrollableWindow) {
|
|
6949
6984
|
tintZoomedWaveform(wavesurfer, fills);
|
|
6950
|
-
|
|
6985
|
+
} else {
|
|
6986
|
+
wavesurfer.setOptions({
|
|
6987
|
+
progressColor: toCanvasFill(fills.progressColor, devicePixelWidth(canvasWidthPx)),
|
|
6988
|
+
waveColor: toCanvasFill(fills.waveColor, devicePixelWidth(canvasWidthPx))
|
|
6989
|
+
});
|
|
6951
6990
|
}
|
|
6952
|
-
|
|
6953
|
-
progressColor
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
}, [activeRangeProgress, bufferProgress, canvasWidthPx, hoverProgress, isRangeDragging, isScrollableWindow, isTape, isZoomed]);
|
|
6991
|
+
if (!isScrollableWindow || isPlayheadDragging) {
|
|
6992
|
+
// WaveSurfer clips progressColor left of this time.
|
|
6993
|
+
const playedUntilSec = isPlayheadDragging && hoverProgress != null ? hoverProgress * durationSecRef.current : currentTimeRef.current;
|
|
6994
|
+
lastSetTimeSecRef.current = playedUntilSec;
|
|
6995
|
+
wavesurfer.setTime(playedUntilSec);
|
|
6996
|
+
}
|
|
6997
|
+
}, [activeRangeProgress, bufferProgress, canvasWidthPx, hoverProgress, isPlayheadDragging, isRangeDragging, isScrollableWindow, isTape, isZoomed]);
|
|
6959
6998
|
(0,external_react_.useEffect)(() => {
|
|
6960
6999
|
const track = trackRef.current;
|
|
6961
7000
|
if (!track) {
|
|
@@ -7068,6 +7107,9 @@ function WaveformView({
|
|
|
7068
7107
|
setHoverProgress(Math.min(1, Math.max(0, pointerX / rect.width)));
|
|
7069
7108
|
}, [durationSec, interactive, isTape]);
|
|
7070
7109
|
const onHoverLeave = (0,external_react_.useCallback)(() => {
|
|
7110
|
+
if (isPlayheadDraggingRef.current) {
|
|
7111
|
+
return;
|
|
7112
|
+
}
|
|
7071
7113
|
setHoverProgress(null);
|
|
7072
7114
|
setIsRangeHovered(false);
|
|
7073
7115
|
}, []);
|
|
@@ -7114,10 +7156,10 @@ function WaveformView({
|
|
|
7114
7156
|
hasPreviousFrame = true;
|
|
7115
7157
|
previousFrameMs = frameMs;
|
|
7116
7158
|
const pointer = getPointerInTrack();
|
|
7117
|
-
const
|
|
7159
|
+
const currentViewport = viewportRef.current;
|
|
7118
7160
|
const scrollDeltaPx = pointer ? (0,waveform_viewport/* getRangeEdgeScrollDeltaPx */.CD)({
|
|
7119
7161
|
elapsedSec,
|
|
7120
|
-
pixelsPerSecond:
|
|
7162
|
+
pixelsPerSecond: currentViewport.pixelsPerSecond,
|
|
7121
7163
|
pointerX: pointer.x,
|
|
7122
7164
|
widthPx: pointer.width
|
|
7123
7165
|
}) : null;
|
|
@@ -7125,8 +7167,8 @@ function WaveformView({
|
|
|
7125
7167
|
pendingScrollPx = 0;
|
|
7126
7168
|
} else {
|
|
7127
7169
|
pendingScrollPx += scrollDeltaPx;
|
|
7128
|
-
const nextScroll = Math.min((0,waveform_viewport/* maxScrollLeft */.d0)(
|
|
7129
|
-
const scrolledPx = nextScroll -
|
|
7170
|
+
const nextScroll = Math.min((0,waveform_viewport/* maxScrollLeft */.d0)(currentViewport), Math.max(0, currentViewport.scrollLeftPx + pendingScrollPx));
|
|
7171
|
+
const scrolledPx = nextScroll - currentViewport.scrollLeftPx;
|
|
7130
7172
|
pendingScrollPx = scrolledPx === 0 ? 0 : pendingScrollPx - scrolledPx;
|
|
7131
7173
|
if (scrolledPx !== 0) {
|
|
7132
7174
|
applyScrollLeft(nextScroll, true);
|
|
@@ -7152,6 +7194,9 @@ function WaveformView({
|
|
|
7152
7194
|
createDragRef.current = null;
|
|
7153
7195
|
onRangeDragChangeRef.current?.(false);
|
|
7154
7196
|
}
|
|
7197
|
+
isPlayheadDraggingRef.current = false;
|
|
7198
|
+
playheadDragRef.current = null;
|
|
7199
|
+
playheadPinRef.current = null;
|
|
7155
7200
|
};
|
|
7156
7201
|
}, []);
|
|
7157
7202
|
(0,external_react_.useLayoutEffect)(() => {
|
|
@@ -7251,7 +7296,7 @@ function WaveformView({
|
|
|
7251
7296
|
const {
|
|
7252
7297
|
target
|
|
7253
7298
|
} = event;
|
|
7254
|
-
if (target instanceof Element && target.closest('.bp-WaveformRange-handle, .bp-WaveformRange-comment')) {
|
|
7299
|
+
if (target instanceof Element && target.closest('.bp-WaveformRange-handle, .bp-WaveformRange-comment, .bp-WaveformView-playhead--draggable')) {
|
|
7255
7300
|
return;
|
|
7256
7301
|
}
|
|
7257
7302
|
const drag = rangeCreateDragFromEvent(event, {
|
|
@@ -7350,6 +7395,112 @@ function WaveformView({
|
|
|
7350
7395
|
const isOverlayReadOnly = rangeReadOnly && createRange == null;
|
|
7351
7396
|
const showPlayheadComment = interactive && !isPlaying && !isRangeDragging && (0,waveform_range/* isRangeCollapsed */.BT)(overlayRange) && Boolean(onPlayheadComment);
|
|
7352
7397
|
const showRangeOverlay = Boolean(overlayRange) && (isRangeDragging || !isPlaying || !(0,waveform_range/* isRangeCollapsed */.BT)(overlayRange));
|
|
7398
|
+
const canDragPlayhead = interactive && !isTape;
|
|
7399
|
+
|
|
7400
|
+
/** Media time under a pointer X on the waveform track. */
|
|
7401
|
+
const mediaTimeFromClientX = clientX => {
|
|
7402
|
+
const track = trackRef.current;
|
|
7403
|
+
if (!track || !(durationSecRef.current > 0) || !Number.isFinite(clientX)) {
|
|
7404
|
+
return null;
|
|
7405
|
+
}
|
|
7406
|
+
const rect = track.getBoundingClientRect();
|
|
7407
|
+
if (!(rect.width > 0)) {
|
|
7408
|
+
return null;
|
|
7409
|
+
}
|
|
7410
|
+
const pointerX = clientX - rect.left;
|
|
7411
|
+
const currentViewport = viewportRef.current;
|
|
7412
|
+
const unclampedTimeSec = currentViewport.pixelsPerSecond > 0 ? (0,waveform_viewport/* timeFromPositionPx */.lZ)(pointerX, currentViewport) : pointerX / rect.width * durationSecRef.current;
|
|
7413
|
+
return Number.isFinite(unclampedTimeSec) ? Math.min(durationSecRef.current, Math.max(0, unclampedTimeSec)) : null;
|
|
7414
|
+
};
|
|
7415
|
+
|
|
7416
|
+
/** CSS playhead + hover fills at timeSec; media seek waits for pointerup. */
|
|
7417
|
+
const showDraggedPlayhead = timeSec => {
|
|
7418
|
+
const playhead = playheadRef.current;
|
|
7419
|
+
if (!playhead) {
|
|
7420
|
+
return;
|
|
7421
|
+
}
|
|
7422
|
+
const drag = playheadDragRef.current;
|
|
7423
|
+
playheadPinRef.current = {
|
|
7424
|
+
fromSec: drag?.fromSec ?? timeSec,
|
|
7425
|
+
sec: timeSec
|
|
7426
|
+
};
|
|
7427
|
+
playhead.style.left = (0,waveform_viewport/* timeLeftPercent */.Mu)(timeSec, durationSecRef.current, viewportRef.current);
|
|
7428
|
+
setHoverProgress(timeSec / durationSecRef.current);
|
|
7429
|
+
};
|
|
7430
|
+
const onPlayheadPointerDown = event => {
|
|
7431
|
+
if (event.target instanceof Element && event.target.closest('.bp-WaveformView-playheadComment')) {
|
|
7432
|
+
return;
|
|
7433
|
+
}
|
|
7434
|
+
if (!canDragPlayhead || event.button > 0 || event.ctrlKey || event.metaKey || isRangeDraggingRef.current) {
|
|
7435
|
+
return;
|
|
7436
|
+
}
|
|
7437
|
+
event.preventDefault();
|
|
7438
|
+
event.stopPropagation();
|
|
7439
|
+
try {
|
|
7440
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
7441
|
+
} catch {
|
|
7442
|
+
return; // Don't start a drag we cannot track after the pointer leaves.
|
|
7443
|
+
}
|
|
7444
|
+
const fromSec = mediaElRef.current ? mediaElRef.current.currentTime : currentTimeRef.current;
|
|
7445
|
+
playheadDragRef.current = {
|
|
7446
|
+
fromSec,
|
|
7447
|
+
pointerId: event.pointerId
|
|
7448
|
+
};
|
|
7449
|
+
playheadPinRef.current = {
|
|
7450
|
+
fromSec,
|
|
7451
|
+
sec: fromSec
|
|
7452
|
+
};
|
|
7453
|
+
isPlayheadDraggingRef.current = true;
|
|
7454
|
+
setIsPlayheadDragging(true);
|
|
7455
|
+
setHoverProgress(durationSecRef.current > 0 ? fromSec / durationSecRef.current : null);
|
|
7456
|
+
clearFollowPin();
|
|
7457
|
+
cancelJump();
|
|
7458
|
+
};
|
|
7459
|
+
const onPlayheadPointerMove = event => {
|
|
7460
|
+
const drag = playheadDragRef.current;
|
|
7461
|
+
if (!drag || event.pointerId !== drag.pointerId) {
|
|
7462
|
+
return;
|
|
7463
|
+
}
|
|
7464
|
+
const timeSec = mediaTimeFromClientX(event.clientX);
|
|
7465
|
+
if (timeSec == null) {
|
|
7466
|
+
return;
|
|
7467
|
+
}
|
|
7468
|
+
event.preventDefault();
|
|
7469
|
+
event.stopPropagation();
|
|
7470
|
+
showDraggedPlayhead(timeSec);
|
|
7471
|
+
};
|
|
7472
|
+
const onPlayheadPointerUp = event => {
|
|
7473
|
+
const drag = playheadDragRef.current;
|
|
7474
|
+
if (!drag || event.pointerId !== drag.pointerId) {
|
|
7475
|
+
return;
|
|
7476
|
+
}
|
|
7477
|
+
event.preventDefault();
|
|
7478
|
+
event.stopPropagation();
|
|
7479
|
+
const timeSec = mediaTimeFromClientX(event.clientX) ?? playheadPinRef.current?.sec;
|
|
7480
|
+
if (timeSec != null) {
|
|
7481
|
+
playheadPinRef.current = {
|
|
7482
|
+
fromSec: drag.fromSec,
|
|
7483
|
+
sec: timeSec
|
|
7484
|
+
};
|
|
7485
|
+
currentTimeRef.current = timeSec;
|
|
7486
|
+
}
|
|
7487
|
+
playheadDragRef.current = null;
|
|
7488
|
+
isPlayheadDraggingRef.current = false;
|
|
7489
|
+
setIsPlayheadDragging(false);
|
|
7490
|
+
if (event.type !== 'lostpointercapture') {
|
|
7491
|
+
try {
|
|
7492
|
+
event.currentTarget.releasePointerCapture?.(event.pointerId);
|
|
7493
|
+
} catch {
|
|
7494
|
+
// Capture was never set or already lost.
|
|
7495
|
+
}
|
|
7496
|
+
}
|
|
7497
|
+
if (timeSec == null) {
|
|
7498
|
+
return;
|
|
7499
|
+
}
|
|
7500
|
+
onPlayheadSeek(timeSec);
|
|
7501
|
+
updatePlayheadPosition(timeSec);
|
|
7502
|
+
onSeekRef.current?.(timeSec);
|
|
7503
|
+
};
|
|
7353
7504
|
const scrubTimeChip = isTape && scrubPreviewTimeSec != null ? /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
7354
7505
|
className: "bp-WaveformView-hover bp-WaveformView-hover--tape",
|
|
7355
7506
|
"data-testid": "bp-waveform-hover"
|
|
@@ -7361,6 +7512,7 @@ function WaveformView({
|
|
|
7361
7512
|
ref: bindOverlayPortalHost,
|
|
7362
7513
|
className: classnames_default()('bp-WaveformView', {
|
|
7363
7514
|
'bp-WaveformView--inert': !interactive,
|
|
7515
|
+
'bp-WaveformView--playheadDragging': isPlayheadDragging,
|
|
7364
7516
|
'bp-WaveformView--tape': isTape,
|
|
7365
7517
|
'bp-WaveformView--zoomed': isZoomed
|
|
7366
7518
|
}),
|
|
@@ -7389,8 +7541,16 @@ function WaveformView({
|
|
|
7389
7541
|
className: "bp-WaveformView-canvas"
|
|
7390
7542
|
}), /*#__PURE__*/external_react_["default"].createElement("div", {
|
|
7391
7543
|
ref: playheadRef,
|
|
7392
|
-
className:
|
|
7393
|
-
|
|
7544
|
+
className: classnames_default()('bp-WaveformView-playhead', {
|
|
7545
|
+
'bp-WaveformView-playhead--draggable': canDragPlayhead
|
|
7546
|
+
}),
|
|
7547
|
+
"data-target-id": canDragPlayhead ? 'Waveform-dragPlayhead' : undefined,
|
|
7548
|
+
"data-testid": "bp-waveform-playhead",
|
|
7549
|
+
onLostPointerCapture: onPlayheadPointerUp,
|
|
7550
|
+
onPointerCancel: onPlayheadPointerUp,
|
|
7551
|
+
onPointerDown: onPlayheadPointerDown,
|
|
7552
|
+
onPointerMove: onPlayheadPointerMove,
|
|
7553
|
+
onPointerUp: onPlayheadPointerUp
|
|
7394
7554
|
}, showPlayheadComment && /*#__PURE__*/external_react_["default"].createElement("button", {
|
|
7395
7555
|
className: "bp-WaveformRange-comment bp-WaveformView-playheadComment",
|
|
7396
7556
|
"data-target-id": "Waveform-commentAtTime",
|
|
@@ -25204,7 +25364,7 @@ class Browser {
|
|
|
25204
25364
|
;// ./src/lib/Logger.js
|
|
25205
25365
|
/* eslint-disable no-undef */
|
|
25206
25366
|
const CLIENT_NAME = "box-content-preview";
|
|
25207
|
-
const CLIENT_VERSION = "3.
|
|
25367
|
+
const CLIENT_VERSION = "3.107.0";
|
|
25208
25368
|
/* eslint-enable no-undef */
|
|
25209
25369
|
|
|
25210
25370
|
class Logger {
|
|
@@ -45512,14 +45672,14 @@ function GalleryGrid({
|
|
|
45512
45672
|
function syncHighRes() {
|
|
45513
45673
|
const store = highResStoreRef.current;
|
|
45514
45674
|
const {
|
|
45515
|
-
pageRatio
|
|
45675
|
+
pageRatio: thumbnailPageRatio
|
|
45516
45676
|
} = thumbnail;
|
|
45517
|
-
if (!store || !
|
|
45677
|
+
if (!store || !thumbnailPageRatio) return;
|
|
45518
45678
|
const width = getNeededThumbWidth();
|
|
45519
45679
|
if (width === GALLERY_THUMB_MAX_WIDTH) {
|
|
45520
|
-
store.setRetained([], width,
|
|
45680
|
+
store.setRetained([], width, thumbnailPageRatio);
|
|
45521
45681
|
} else if (!isProcessingRef.current) {
|
|
45522
|
-
store.setRetained(getPagesNearViewport(0.5), width,
|
|
45682
|
+
store.setRetained(getPagesNearViewport(0.5), width, thumbnailPageRatio);
|
|
45523
45683
|
}
|
|
45524
45684
|
}
|
|
45525
45685
|
function getUnloadedNearViewport() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box-content-preview",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.107.0",
|
|
4
4
|
"description": "Box Content Preview UI Element",
|
|
5
5
|
"author": "Box (https://www.box.com/)",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "^7.18.6",
|
|
50
|
+
"@babel/eslint-parser": "^7.24.1",
|
|
50
51
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
51
52
|
"@babel/plugin-proposal-object-rest-spread": "^7.18.6",
|
|
52
53
|
"@babel/plugin-transform-object-assign": "^7.18.6",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"@babel/preset-typescript": "^7.18.6",
|
|
56
57
|
"@box/blueprint-web": "^17.11.3",
|
|
57
58
|
"@box/blueprint-web-assets": "^5.10.10",
|
|
58
|
-
"@box/frontend": "^
|
|
59
|
+
"@box/frontend": "^11.0.1",
|
|
59
60
|
"@box/languages": "^1.0.0",
|
|
60
61
|
"@box/react-virtualized": "9.22.3-rc-box.2",
|
|
61
62
|
"@commitlint/cli": "^19.8.0",
|
|
@@ -70,8 +71,8 @@
|
|
|
70
71
|
"@types/lodash": "^4.14.149",
|
|
71
72
|
"@types/react": "18.3.1",
|
|
72
73
|
"@types/react-dom": "18.3.1",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
74
|
-
"@typescript-eslint/parser": "^
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
|
75
|
+
"@typescript-eslint/parser": "^7.3.1",
|
|
75
76
|
"autoprefixer": "^10.4.21",
|
|
76
77
|
"axios": "^0.34.0",
|
|
77
78
|
"babel-jest": "^29.7.0",
|
|
@@ -87,21 +88,17 @@
|
|
|
87
88
|
"css-loader": "^6.11.0",
|
|
88
89
|
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
89
90
|
"cypress": "^15.20.1",
|
|
90
|
-
"eslint": "^8.
|
|
91
|
-
"eslint-config-airbnb": "^
|
|
92
|
-
"eslint-config-prettier": "^
|
|
93
|
-
"eslint-plugin-babel": "^5.3.0",
|
|
91
|
+
"eslint": "^8.57.0",
|
|
92
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
93
|
+
"eslint-config-prettier": "^9.1.0",
|
|
94
94
|
"eslint-plugin-chai-friendly": "^0.4.1",
|
|
95
95
|
"eslint-plugin-cypress": "^2.8.1",
|
|
96
|
-
"eslint-plugin-
|
|
97
|
-
"eslint-plugin-
|
|
98
|
-
"eslint-plugin-
|
|
99
|
-
"eslint-plugin-
|
|
100
|
-
"eslint-plugin-
|
|
101
|
-
"eslint-plugin-
|
|
102
|
-
"eslint-plugin-prettier": "5.2.3",
|
|
103
|
-
"eslint-plugin-react": "^7.17.0",
|
|
104
|
-
"eslint-plugin-react-hooks": "^1.7.0",
|
|
96
|
+
"eslint-plugin-formatjs": "^4.12.2",
|
|
97
|
+
"eslint-plugin-import": "^2.29.1",
|
|
98
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
99
|
+
"eslint-plugin-lodash": "^7.4.0",
|
|
100
|
+
"eslint-plugin-react": "^7.34.1",
|
|
101
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
105
102
|
"file-loader": "^6.2.0",
|
|
106
103
|
"fscreen": "^1.0.2",
|
|
107
104
|
"husky": "^3.1.0",
|
|
@@ -128,9 +125,10 @@
|
|
|
128
125
|
"sinon": "^9.0.3",
|
|
129
126
|
"style-loader": "^4.0.0",
|
|
130
127
|
"stylelint": "^16.26.1",
|
|
128
|
+
"stylelint-config-clean-order": "7.0.0",
|
|
131
129
|
"stylelint-config-standard": "^38.0.0",
|
|
132
|
-
"stylelint-config-standard-scss": "^
|
|
133
|
-
"stylelint-order": "^
|
|
130
|
+
"stylelint-config-standard-scss": "^15.0.1",
|
|
131
|
+
"stylelint-order": "^7.0.0",
|
|
134
132
|
"terser": "^5.31.0",
|
|
135
133
|
"terser-webpack-plugin": "^5.3.14",
|
|
136
134
|
"typescript": "^5.0.4",
|
|
@@ -160,8 +158,8 @@
|
|
|
160
158
|
"cy:wait": "wait-on http-get://127.0.0.1:8000",
|
|
161
159
|
"lint": "npm-run-all lint:*",
|
|
162
160
|
"lint:css": "NODE_ENV=dev yarn stylelint 'src/lib/**/*.scss' 'src/components/**/*.scss' 'src/hooks/**/*.scss'",
|
|
163
|
-
"lint:js": "
|
|
164
|
-
"lint:ts": "tsc
|
|
161
|
+
"lint:js": "eslint --max-warnings=0 src cypress.config.ts",
|
|
162
|
+
"lint:ts": "tsc",
|
|
165
163
|
"release": "yarn setup && yarn clean && yarn build:i18n && yarn lint && yarn test && yarn build:prod",
|
|
166
164
|
"release:major": "./build/release.sh -m",
|
|
167
165
|
"release:minor": "./build/release.sh -n",
|