box-content-preview 3.99.0 → 3.101.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 +1 -1
- package/dist/lib/index.js +165 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://mergify.io)
|
|
3
3
|
[](https://github.com/prettier/prettier)
|
|
4
4
|
[](https://travis-ci.org/box/box-content-preview)
|
|
5
|
-
[](https://github.com/box/box-content-preview)
|
|
6
6
|
[](https://www.npmjs.com/package/box-ui-elements)
|
|
7
7
|
|
|
8
8
|
# [Box Content Preview](https://developer.box.com/docs/box-content-preview)
|
|
@@ -22,11 +22,11 @@ We encourage all users to update their applications to utilize modern browsers f
|
|
|
22
22
|
|
|
23
23
|
## Current Version
|
|
24
24
|
|
|
25
|
-
- Version: v3.
|
|
25
|
+
- Version: v3.101.0
|
|
26
26
|
- Locale: en-US
|
|
27
27
|
|
|
28
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
29
|
-
https://cdn01.boxcdn.net/platform/preview/3.
|
|
28
|
+
https://cdn01.boxcdn.net/platform/preview/3.101.0/en-US/preview.js
|
|
29
|
+
https://cdn01.boxcdn.net/platform/preview/3.101.0/en-US/preview.css
|
|
30
30
|
|
|
31
31
|
## Supported Locales
|
|
32
32
|
|
|
@@ -52,10 +52,10 @@ You can self-host the Box Content Preview library or reference the versions avai
|
|
|
52
52
|
<title>Box Content Preview Demo</title>
|
|
53
53
|
|
|
54
54
|
<!-- Latest version of Preview SDK for your locale -->
|
|
55
|
-
<script src="https://cdn01.boxcdn.net/platform/preview/3.
|
|
55
|
+
<script src="https://cdn01.boxcdn.net/platform/preview/3.101.0/en-US/preview.js"></script>
|
|
56
56
|
<link
|
|
57
57
|
rel="stylesheet"
|
|
58
|
-
href="https://cdn01.boxcdn.net/platform/preview/3.
|
|
58
|
+
href="https://cdn01.boxcdn.net/platform/preview/3.101.0/en-US/preview.css"
|
|
59
59
|
/>
|
|
60
60
|
</head>
|
|
61
61
|
<body>
|
|
@@ -76,7 +76,7 @@ To self-host the Box Content Preview library, follow these steps:
|
|
|
76
76
|
|
|
77
77
|
1. Either fork the repo and check out the version you want to host or download the specific version as a zip:
|
|
78
78
|
|
|
79
|
-
- Check out a specific version with `git checkout v3.
|
|
79
|
+
- Check out a specific version with `git checkout v3.101.0`
|
|
80
80
|
- Download a specific version as a zip from https://github.com/box/box-content-preview/releases
|
|
81
81
|
|
|
82
82
|
2. Install dependencies and build the library with `yarn install && yarn build:i18n && yarn build:prod`
|
package/dist/lib/index.css
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
.bp-WaveformGeneratingIndicator{display:flex;gap:4px;align-items:center;height:48px;padding:8px 16px 8px 12px;pointer-events:none}.bp-WaveformGeneratingIndicator-bars{display:flex;flex:0 0 24px;align-items:center;justify-content:center;width:24px;height:24px}.bp-WaveformGeneratingIndicator-bar{width:2px;height:10px;background:rgba(255,255,255,.3);border-radius:6px;animation:bp-WaveformGeneratingIndicator-pulse .66s ease-in-out infinite}.bp-WaveformGeneratingIndicator-bar:nth-child(2){margin-left:2px;animation-delay:.1s}.bp-WaveformGeneratingIndicator-bar:last-child{margin-left:2px;animation-delay:.2s}.bp-WaveformGeneratingIndicator-label{color:#fff;font-weight:normal;font-size:14px;line-height:22px;white-space:nowrap}@keyframes bp-WaveformGeneratingIndicator-pulse{0%,80%,100%{background:rgba(255,255,255,.3);transform:scaleY(1.2)}40%{background:#fff;transform:scaleY(1.6)}}@media(prefers-reduced-motion: reduce){.bp-WaveformGeneratingIndicator-bar{animation:none;background:#fff;transform:none}}
|
|
64
64
|
.bp-WaveformShuttle{position:absolute;top:48px;left:50%;z-index:6;display:flex;gap:4px;align-items:center;height:48px;padding:8px 16px;color:#fff;background:rgba(255,255,255,.1);border-radius:24px;box-shadow:0 2px 12px rgba(0,0,0,.08);transform:translateX(-50%);backdrop-filter:blur(60px);pointer-events:none;-webkit-user-select:none;user-select:none}.bp-WaveformShuttle-glyph{display:block;flex:0 0 auto;width:19px;height:11px}.bp-WaveformShuttle.bp-is-reverse .bp-WaveformShuttle-glyph{transform:scaleX(-1)}.bp-WaveformShuttle-rate{font-weight:500;font-size:14px;line-height:22px;white-space:nowrap}
|
|
65
65
|
.bp-WaveformRange{position:absolute;inset:0;z-index:2;pointer-events:none}.bp-WaveformRange-region{position:absolute;top:50%;box-sizing:border-box;height:150px;pointer-events:none;background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.4);border-radius:10px;box-shadow:0 0 0 1px #222;transform:translateY(-50%);transition:border-width 100ms ease,border-color 100ms ease}.bp-WaveformRange--swiping .bp-WaveformRange-region{visibility:hidden}.bp-WaveformRange--highlight .bp-WaveformRange-region,.bp-WaveformRange:has(.bp-WaveformRange-handle:hover) .bp-WaveformRange-region,.bp-WaveformRange:has(.bp-WaveformRange-handle--dragging) .bp-WaveformRange-region{border-width:2px;border-color:#fff}.bp-WaveformRange-handle{position:absolute;top:50%;z-index:1;width:24px;height:150px;pointer-events:auto;cursor:ew-resize;touch-action:none;transform:translate(-50%, -50%)}.bp-WaveformRange-handle--end{z-index:2}.bp-WaveformRange-handleGrip{position:absolute;top:50%;left:50%;width:8px;height:20px;background:#fff;border:1px solid #222;border-radius:4px;box-shadow:0 1px 4px rgba(0,0,0,.4);opacity:0;pointer-events:none;transform:translate(-50%, -50%) scale(0.5);transition:opacity 100ms ease-in,transform 100ms ease-in}.bp-WaveformRange-handle:hover .bp-WaveformRange-handleGrip,.bp-WaveformRange-handle:focus-visible .bp-WaveformRange-handleGrip,.bp-WaveformRange-handle--dragging .bp-WaveformRange-handleGrip{opacity:1;transform:translate(-50%, -50%) scale(1);transition:opacity 150ms ease-out,transform 150ms ease-out}.bp-WaveformRange-comment{position:absolute;top:calc(50% - 75px);z-index:5;display:inline-flex;gap:8px;align-items:center;justify-content:center;box-sizing:border-box;height:48px;padding:8px 14px;color:rgba(255,255,255,.8);font-weight:normal;font-size:14px;font-family:Lato,Arial,sans-serif;line-height:22px;letter-spacing:.1px;white-space:nowrap;background:rgba(0,0,0,.8);border:0;backdrop-filter:blur(12px);border-radius:46px;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);transform:translate(-50%, calc(-100% - 36px));cursor:pointer;appearance:none;pointer-events:auto}.bp-WaveformRange-comment--withClear{gap:4px;padding:8px 8px 8px 12px;cursor:default}.bp-WaveformRange-comment--clearOnly{width:48px;height:48px;padding:0;border-radius:50%}.bp-WaveformRange-commentLabel,.bp-WaveformRange-commentClear{display:inline-flex;align-items:center;justify-content:center;padding:0;color:inherit;font:inherit;letter-spacing:inherit;background:transparent;border:0;cursor:pointer;appearance:none}.bp-WaveformRange-commentLabel{gap:8px;height:32px;padding:0 6px}.bp-WaveformRange-commentDivider{flex:0 0 auto;width:1px;height:16px;background:rgba(255,255,255,.4)}.bp-WaveformRange-commentClear{width:32px;height:32px;border-radius:50%}.bp-WaveformRange-commentIcon{display:block;flex:0 0 auto;width:20px;height:20px;fill:currentcolor}.bp-WaveformView--tape .bp-WaveformRange-comment{top:calc(50% - (100% + 10px) / 2)}.bp-WaveformRange-tooltip{position:absolute;top:100%;z-index:3;margin-top:4px;pointer-events:none;transform:translateX(-50%)}.bp-WaveformRange-tooltipTime{padding:4px 10px;color:#fff;font-weight:normal;font-size:14px;font-family:Lato,Arial,sans-serif;line-height:20px;letter-spacing:.3px;white-space:nowrap;background:rgba(34,34,34,.92);border:1px solid rgba(255,255,255,.18);border-radius:8px}@media(prefers-reduced-motion: reduce){.bp-WaveformRange-region,.bp-WaveformRange-handleGrip{transition:none}}
|
|
66
|
-
.bp-WaveformView{box-sizing:border-box;width:100%;height:206px;min-height:206px;padding:0 60px;overflow:visible;background:none;-webkit-tap-highlight-color:transparent}.bp-WaveformView.bp-WaveformView--zoomed,.bp-WaveformView.bp-WaveformView--tape{padding:0;touch-action:none}.bp-WaveformView.bp-WaveformView--zoomed .bp-WaveformView-canvas,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas{overflow:hidden;mask-image:linear-gradient(to right, transparent, #000 92px, #000 calc(100% - 92px), transparent)}.bp-WaveformView.bp-WaveformView--zoomed .bp-WaveformView-canvas>*::part(scroll),.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas>*::part(scroll){overscroll-behavior-x:none}.bp-WaveformView.bp-WaveformView--tape{flex:1 1 auto;height:100%;min-height:0}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas{height:100%}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas>*::part(scroll){scrollbar-width:none}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-playhead,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformRange-region,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformRange-handle{height:calc(100% + 10px)}.bp-WaveformView-track{position:relative;display:flex;align-items:center;width:100%;height:100%;cursor:pointer}.bp-WaveformView-canvas{z-index:0;width:100%;height:140px}.bp-WaveformView-playhead{position:absolute;top:50%;left:0;z-index:1;width:2px;height:150px;pointer-events:none;background:linear-gradient(#2487ff, #006bed);border-radius:1px;box-shadow:0 0 0 1px #222,0 0 10px 0 rgba(36,135,255,.3);transform:translate(-50%, -50%)}.bp-WaveformView-hover{position:absolute;top:100%;z-index:2;margin-top:4px;pointer-events:none;transform:translateX(-50%)}.bp-WaveformView-hover--tape{top:-24px;left:50%;z-index:5;margin-top:0;transform:translate(-50%, -50%)}.bp-WaveformView-hoverTime{padding:4px 10px;color:#fff;font-weight:normal;font-size:14px;font-family:Lato,Arial,sans-serif;line-height:20px;letter-spacing:.3px;white-space:nowrap;background:rgba(34,34,34,.92);border:1px solid rgba(255,255,255,.18);border-radius:8px}.bp-WaveformView--inert{pointer-events:none}.bp-WaveformView--inert .bp-WaveformView-track{cursor:default}.bp-WaveformView--inert .bp-WaveformRange-handle,.bp-WaveformView--inert .bp-WaveformRange-comment,.bp-WaveformView--inert .bp-WaveformRange-commentLabel,.bp-WaveformView--inert .bp-WaveformRange-commentClear{pointer-events:none;cursor:default}.bp-WaveformView:not(:hover) .bp-WaveformRange:not(.bp-WaveformRange--persist){opacity:.4}
|
|
66
|
+
.bp-WaveformView{box-sizing:border-box;width:100%;height:206px;min-height:206px;padding:0 60px;overflow:visible;background:none;-webkit-tap-highlight-color:transparent}.bp-WaveformView.bp-WaveformView--zoomed,.bp-WaveformView.bp-WaveformView--tape{padding:0;touch-action:none}.bp-WaveformView.bp-WaveformView--zoomed .bp-WaveformView-canvas,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas{overflow:hidden;mask-image:linear-gradient(to right, transparent, #000 92px, #000 calc(100% - 92px), transparent)}.bp-WaveformView.bp-WaveformView--zoomed .bp-WaveformView-canvas>*::part(scroll),.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas>*::part(scroll){overscroll-behavior-x:none}.bp-WaveformView.bp-WaveformView--tape{flex:1 1 auto;height:100%;min-height:0;-webkit-touch-callout:none}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas{height:100%}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-canvas>*::part(scroll){scrollbar-width:none}.bp-WaveformView.bp-WaveformView--tape .bp-WaveformView-playhead,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformRange-region,.bp-WaveformView.bp-WaveformView--tape .bp-WaveformRange-handle{height:calc(100% + 10px)}.bp-WaveformView-track{position:relative;display:flex;align-items:center;width:100%;height:100%;cursor:pointer}.bp-WaveformView-canvas{z-index:0;width:100%;height:140px}.bp-WaveformView-playhead{position:absolute;top:50%;left:0;z-index:1;width:2px;height:150px;pointer-events:none;background:linear-gradient(#2487ff, #006bed);border-radius:1px;box-shadow:0 0 0 1px #222,0 0 10px 0 rgba(36,135,255,.3);transform:translate(-50%, -50%)}.bp-WaveformView-hover{position:absolute;top:100%;z-index:2;margin-top:4px;pointer-events:none;transform:translateX(-50%)}.bp-WaveformView-hover--tape{top:-24px;left:50%;z-index:5;margin-top:0;transform:translate(-50%, -50%)}.bp-WaveformView-hoverTime{padding:4px 10px;color:#fff;font-weight:normal;font-size:14px;font-family:Lato,Arial,sans-serif;line-height:20px;letter-spacing:.3px;white-space:nowrap;background:rgba(34,34,34,.92);border:1px solid rgba(255,255,255,.18);border-radius:8px}.bp-WaveformView--inert{pointer-events:none}.bp-WaveformView--inert .bp-WaveformView-track{cursor:default}.bp-WaveformView--inert .bp-WaveformRange-handle,.bp-WaveformView--inert .bp-WaveformRange-comment,.bp-WaveformView--inert .bp-WaveformRange-commentLabel,.bp-WaveformView--inert .bp-WaveformRange-commentClear{pointer-events:none;cursor:default}.bp-WaveformView:not(:hover) .bp-WaveformRange:not(.bp-WaveformRange--persist){opacity:.4}
|
|
67
67
|
.bp-SliderControl{outline:0;position:relative;cursor:pointer}.bp-SliderControl:focus:not(:disabled){box-shadow:inset 0 0 0 1px rgba(211,211,211,.5),0 1px 2px rgba(0,0,0,.1)}.bp-SliderControl:focus-visible:not(:disabled){box-shadow:inset 0 0 0 1px rgba(211,211,211,.5),0 1px 2px rgba(0,0,0,.1)}.bp-SliderControl:focus:not(:focus-visible){box-shadow:none}.bp-SliderControl-thumb{position:absolute;top:calc(50% - 6px);width:12px;height:12px;margin-left:-6px;background:#0061d5;border:0;border-radius:12px;cursor:pointer}.bp-SliderControl-track{position:absolute;inset:0;height:3px;margin:auto 3px;background:transparent linear-gradient(#fff, #fff) no-repeat center border-box}
|
|
68
68
|
.bp-WaveformZoomControl{display:flex;flex-direction:row;gap:0;align-items:center;justify-content:flex-end;width:48px;height:48px;padding:4px;overflow:hidden;background:rgba(255,255,255,.1);border-radius:32px;box-shadow:0 2px 12px rgba(0,0,0,.08);backdrop-filter:blur(60px);transition:width 150ms ease-out,gap 150ms ease-out}.bp-WaveformZoomControl.bp-has-multiplier{padding:4px 4px 4px 12px}.bp-WaveformZoomControl.bp-has-multiplier:not(.bp-is-open){width:88px}.bp-WaveformZoomControl.bp-is-open{gap:8px;width:207px}.bp-WaveformZoomControl.bp-is-open.bp-has-multiplier{width:264px}.bp-WaveformZoomControl-multiplier{display:flex;flex:0 0 32px;order:-3;align-items:center;justify-content:center;width:32px;height:32px;color:#fff;font-weight:500;font-size:14px;line-height:22px;pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap}.bp-WaveformZoomControl-divider{display:none;flex:0 0 1px;order:-2;width:1px;height:28px;background:rgba(255,255,255,.3)}.bp-WaveformZoomControl.bp-is-open.bp-has-multiplier .bp-WaveformZoomControl-divider{display:block}.bp-WaveformZoomControl-flyout{display:flex;flex:0 0 auto;order:-1;gap:8px;align-items:center;width:0;height:40px;overflow:hidden;transition:width 150ms ease-out}.bp-WaveformZoomControl-flyout.bp-is-open{width:151px}.bp-WaveformZoomControl-slider{width:103px;height:8px}.bp-WaveformZoomControl-slider .bp-SliderControl-track{height:8px;margin:0;background:rgba(255,255,255,.3);background-image:none;border-radius:20px}.bp-WaveformZoomControl-slider .bp-SliderControl-track::after{position:absolute;top:0;left:0;width:calc(8px + 95px * var(--bp-zoom-t, 0));height:8px;background:rgba(255,255,255,.9);border-radius:20px;content:""}.bp-WaveformZoomControl-slider .bp-SliderControl-thumb{display:none}.bp-WaveformZoomControl-button{position:relative;z-index:1;display:flex;flex:0 0 40px;align-items:center;justify-content:center;width:40px;height:40px;padding:0;color:#fff;background:transparent;border:0;border-radius:50%;cursor:pointer}.bp-WaveformZoomControl-button[aria-disabled=true]{cursor:default;opacity:.3}.bp-WaveformZoomControl-button svg{width:20px;height:20px;padding:0}@media(prefers-reduced-motion: reduce){.bp-WaveformZoomControl,.bp-WaveformZoomControl-flyout{transition:none}}
|
|
69
69
|
.bp-MP3ControlsRoot:has(.bp-MP3ControlsV2){position:absolute;inset:0;width:100%;height:100%;transform:none;pointer-events:none}.bp-MP3ControlsV2{--bp-waveform-bar-min: 140px;position:relative;width:100%;max-width:none;height:100%;background:transparent;pointer-events:none}.bp-MP3ControlsV2-stage{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;min-height:0;pointer-events:none}.bp-MP3ControlsV2-stage .bp-WaveformView,.bp-MP3ControlsV2-stage .bp-MP3ControlsV2-waveform,.bp-MP3ControlsV2-stage .bp-WaveformCommentMarkers{pointer-events:auto}.bp-MP3ControlsV2-waveform{position:relative;width:100%;overflow:visible}.bp-MP3ControlsV2-stage:has(.bp-WaveformView--tape) .bp-MP3ControlsV2-waveform{display:flex;flex-direction:column;height:max(var(--bp-waveform-bar-min, 140px), 25%);min-height:0}.bp-MP3ControlsV2-waveformZoom{position:absolute;top:48px;right:48px;z-index:4;pointer-events:none}.bp-MP3ControlsV2-waveformZoom .bp-WaveformZoomControl{pointer-events:auto}.bp-MP3ControlsV2-playOverlay{position:absolute;top:50%;left:50%;z-index:2;display:flex;align-items:center;justify-content:center;width:80px;height:80px;padding:0;background:rgba(0,0,0,.5);border:0;border-radius:50%;transform:translate(-50%, -50%);cursor:pointer;pointer-events:auto}.bp-MP3ControlsV2-playOverlay svg{width:48px;height:48px;fill:#fff}.bp-MP3ControlsV2-stage .bp-media-buffering-spinner{z-index:2;pointer-events:none}.bp-MP3ControlsV2-bar{position:absolute;right:0;bottom:0;left:0;z-index:2;display:flex;align-items:center;justify-content:space-between;min-height:32px;padding:30px 58px 25px;background:linear-gradient(to top, black, rgba(0, 0, 0, 0));pointer-events:auto}.bp-MP3ControlsV2-group{display:flex;gap:12px;align-items:center}.bp-MP3ControlsV2-divider{width:1px;height:24px;background-color:rgba(255,255,255,.1);border-radius:1px}.bp-MP3ControlsV2 .bp-MP3Controls-settings{position:relative}.bp-MP3ControlsV2 .bp-MP3Controls-settings .bp-SettingsFlyout{right:15px}.bp-MP3ControlsV2 .bp-MP3Controls-settings .bp-SettingsToggle-button{width:36px;height:40px}
|
package/dist/lib/index.js
CHANGED
|
@@ -1029,7 +1029,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
1029
1029
|
const CLIENT_NAME = "box-content-preview"; // eslint-disable-line no-undef
|
|
1030
1030
|
const CLIENT_NAME_KEY = 'box_client_name';
|
|
1031
1031
|
const CLIENT_VERSION_KEY = 'box_client_version';
|
|
1032
|
-
const CLIENT_VERSION = "3.
|
|
1032
|
+
const CLIENT_VERSION = "3.101.0"; // eslint-disable-line no-undef
|
|
1033
1033
|
const HEADER_CLIENT_NAME = 'X-Box-Client-Name';
|
|
1034
1034
|
const HEADER_CLIENT_VERSION = 'X-Box-Client-Version';
|
|
1035
1035
|
const PROMISE_MAP = {};
|
|
@@ -6347,8 +6347,10 @@ function WaveformView({
|
|
|
6347
6347
|
const isRangeDraggingRef = (0,external_react_.useRef)(false);
|
|
6348
6348
|
const rangeRef = (0,external_react_.useRef)(range); // latest committed draft; drag-create must not start on top of an open span
|
|
6349
6349
|
const createDragRef = (0,external_react_.useRef)(null);
|
|
6350
|
+
const tapeRangeHoldRef = (0,external_react_.useRef)(false); // a tape long-press is waiting to draw; touch must not scroll
|
|
6350
6351
|
const rangeDragPointerXRef = (0,external_react_.useRef)(null); // clientX while a handle or create-drag is down
|
|
6351
6352
|
const removeCreateDragListenersRef = (0,external_react_.useRef)(null);
|
|
6353
|
+
const removeTapeContextMenuRef = (0,external_react_.useRef)(null);
|
|
6352
6354
|
const skipNextSeekRef = (0,external_react_.useRef)(false); // ignore the click fired when a handle is released
|
|
6353
6355
|
const lastSetTimeSecRef = (0,external_react_.useRef)(null);
|
|
6354
6356
|
const [isRangeHovered, setIsRangeHovered] = (0,external_react_.useState)(false);
|
|
@@ -6460,6 +6462,20 @@ function WaveformView({
|
|
|
6460
6462
|
widthPx: viewport.widthPx,
|
|
6461
6463
|
zoomLevel: viewport.zoomLevel
|
|
6462
6464
|
});
|
|
6465
|
+
const drag = createDragRef.current;
|
|
6466
|
+
const clientX = rangeDragPointerXRef.current;
|
|
6467
|
+
const track = trackRef.current;
|
|
6468
|
+
if (!drag?.active || clientX == null || !track) {
|
|
6469
|
+
return;
|
|
6470
|
+
}
|
|
6471
|
+
const playheadSec = mediaElRef.current ? mediaElRef.current.currentTime : currentTimeRef.current;
|
|
6472
|
+
const drawn = drawnRangeFromMove(drag, clientX, track, viewportRef.current, playheadSec, durationSecRef.current);
|
|
6473
|
+
if (drawn.startMs === drag.range?.startMs && drawn.endMs === drag.range?.endMs) {
|
|
6474
|
+
return;
|
|
6475
|
+
}
|
|
6476
|
+
drag.range = drawn;
|
|
6477
|
+
setCreateRange(drawn);
|
|
6478
|
+
setPreviewRange(drawn);
|
|
6463
6479
|
}, [viewport]);
|
|
6464
6480
|
const setZoomLevel = (0,external_react_.useCallback)(nextZoom => {
|
|
6465
6481
|
const zoom = (0,waveform_viewport/* clampWaveformZoom */.ii)(nextZoom, maxZoom);
|
|
@@ -6923,6 +6939,10 @@ function WaveformView({
|
|
|
6923
6939
|
markPointerZoom();
|
|
6924
6940
|
};
|
|
6925
6941
|
const onTouchMove = event => {
|
|
6942
|
+
// A tape hold or range drag owns the touch. A desktop press can still scroll.
|
|
6943
|
+
if (cameraModeRef.current === 'tape' && (tapeRangeHoldRef.current || createDragRef.current)) {
|
|
6944
|
+
event.preventDefault();
|
|
6945
|
+
}
|
|
6926
6946
|
const pinch = pinchStartRef.current;
|
|
6927
6947
|
if (!interactiveRef.current || !hasZoomHandlersRef.current || !pinch || event.touches.length !== 2 || !(pinch.distance > 0)) {
|
|
6928
6948
|
return;
|
|
@@ -7065,6 +7085,7 @@ function WaveformView({
|
|
|
7065
7085
|
(0,external_react_.useEffect)(() => {
|
|
7066
7086
|
return () => {
|
|
7067
7087
|
removeCreateDragListenersRef.current?.();
|
|
7088
|
+
removeTapeContextMenuRef.current?.();
|
|
7068
7089
|
if (createDragRef.current?.active) {
|
|
7069
7090
|
createDragRef.current = null;
|
|
7070
7091
|
onRangeDragChangeRef.current?.(false);
|
|
@@ -7077,26 +7098,20 @@ function WaveformView({
|
|
|
7077
7098
|
}
|
|
7078
7099
|
setCreateRange(current => current == null ? current : null);
|
|
7079
7100
|
}, [range]);
|
|
7080
|
-
const
|
|
7081
|
-
if (cameraModeRef.current === 'tape' || !interactiveRef.current || event.button > 0 || event.ctrlKey || event.metaKey || isRangeDraggingRef.current || createDragRef.current) {
|
|
7082
|
-
return;
|
|
7083
|
-
}
|
|
7084
|
-
const {
|
|
7085
|
-
target
|
|
7086
|
-
} = event;
|
|
7087
|
-
if (target instanceof Element && target.closest('[data-testid="bp-waveform-range-handle-start"], [data-testid="bp-waveform-range-handle-end"], [data-testid="bp-waveform-range-comment"]')) {
|
|
7088
|
-
return;
|
|
7089
|
-
}
|
|
7090
|
-
const drag = rangeCreateDragFromEvent(event, {
|
|
7091
|
-
durationSec: durationSecRef.current,
|
|
7092
|
-
range: rangeRef.current,
|
|
7093
|
-
track: trackRef.current,
|
|
7094
|
-
viewport: viewportRef.current
|
|
7095
|
-
});
|
|
7096
|
-
if (!drag) {
|
|
7097
|
-
return;
|
|
7098
|
-
}
|
|
7101
|
+
const startRangeCreateDrag = (0,external_react_.useCallback)((drag, capture) => {
|
|
7099
7102
|
createDragRef.current = drag;
|
|
7103
|
+
rangeDragPointerXRef.current = drag.originX;
|
|
7104
|
+
const track = trackRef.current;
|
|
7105
|
+
if (capture && track && typeof track.setPointerCapture === 'function') {
|
|
7106
|
+
try {
|
|
7107
|
+
track.setPointerCapture(drag.pointerId);
|
|
7108
|
+
} catch (error) {
|
|
7109
|
+
const lostPointer = error instanceof DOMException && (error.name === 'NotFoundError' || error.name === 'InvalidStateError');
|
|
7110
|
+
if (!lostPointer) {
|
|
7111
|
+
console.warn('Pointer capture failed', error); // eslint-disable-line no-console
|
|
7112
|
+
}
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7100
7115
|
const onMove = moveEvent => {
|
|
7101
7116
|
if (createDragRef.current !== drag || moveEvent.pointerId !== drag.pointerId) {
|
|
7102
7117
|
return;
|
|
@@ -7104,16 +7119,24 @@ function WaveformView({
|
|
|
7104
7119
|
if (!Number.isFinite(moveEvent.clientX)) {
|
|
7105
7120
|
return;
|
|
7106
7121
|
}
|
|
7122
|
+
// Capture runs before WaveSurfer's document drag, which stops the event after a few pixels.
|
|
7123
|
+
if (capture) {
|
|
7124
|
+
moveEvent.preventDefault();
|
|
7125
|
+
moveEvent.stopPropagation();
|
|
7126
|
+
}
|
|
7127
|
+
rangeDragPointerXRef.current = moveEvent.clientX;
|
|
7107
7128
|
if (!drag.active && Math.abs(moveEvent.clientX - drag.originX) < constants/* WAVEFORM_RANGE_CREATE_DRAG_PX */.B4) {
|
|
7108
7129
|
return;
|
|
7109
7130
|
}
|
|
7110
|
-
const
|
|
7111
|
-
if (!
|
|
7131
|
+
const moveTrack = trackRef.current;
|
|
7132
|
+
if (!moveTrack) {
|
|
7112
7133
|
return;
|
|
7113
7134
|
}
|
|
7114
|
-
|
|
7135
|
+
if (!capture) {
|
|
7136
|
+
moveEvent.preventDefault();
|
|
7137
|
+
}
|
|
7115
7138
|
const playheadSec = mediaElRef.current ? mediaElRef.current.currentTime : currentTimeRef.current;
|
|
7116
|
-
drag.range = drawnRangeFromMove(drag, moveEvent.clientX,
|
|
7139
|
+
drag.range = drawnRangeFromMove(drag, moveEvent.clientX, moveTrack, viewportRef.current, playheadSec, durationSecRef.current);
|
|
7117
7140
|
if (!drag.active) {
|
|
7118
7141
|
drag.active = true;
|
|
7119
7142
|
handleRangeDragChange(true);
|
|
@@ -7123,9 +7146,13 @@ function WaveformView({
|
|
|
7123
7146
|
};
|
|
7124
7147
|
let onUp = () => undefined;
|
|
7125
7148
|
const removeListeners = () => {
|
|
7126
|
-
window.removeEventListener('pointermove', onMove);
|
|
7127
|
-
window.removeEventListener('pointerup', onUp);
|
|
7128
|
-
window.removeEventListener('pointercancel', onUp);
|
|
7149
|
+
window.removeEventListener('pointermove', onMove, capture);
|
|
7150
|
+
window.removeEventListener('pointerup', onUp, capture);
|
|
7151
|
+
window.removeEventListener('pointercancel', onUp, capture);
|
|
7152
|
+
const captured = trackRef.current;
|
|
7153
|
+
if (capture && captured && typeof captured.hasPointerCapture === 'function' && captured.hasPointerCapture(drag.pointerId)) {
|
|
7154
|
+
captured.releasePointerCapture(drag.pointerId);
|
|
7155
|
+
}
|
|
7129
7156
|
if (removeCreateDragListenersRef.current === removeListeners) {
|
|
7130
7157
|
removeCreateDragListenersRef.current = null;
|
|
7131
7158
|
}
|
|
@@ -7139,6 +7166,8 @@ function WaveformView({
|
|
|
7139
7166
|
createDragRef.current = null;
|
|
7140
7167
|
removeListeners();
|
|
7141
7168
|
if (!wasActive || !drawn) {
|
|
7169
|
+
// This pointerup still reaches the tape track. Swallow it so a still hold does not play.
|
|
7170
|
+
suppressTapToPlayPause();
|
|
7142
7171
|
return;
|
|
7143
7172
|
}
|
|
7144
7173
|
const committed = (0,waveform_range/* commitRangeChange */.dG)(drawn);
|
|
@@ -7149,10 +7178,107 @@ function WaveformView({
|
|
|
7149
7178
|
handleRangeDragChange(false);
|
|
7150
7179
|
};
|
|
7151
7180
|
removeCreateDragListenersRef.current = removeListeners;
|
|
7152
|
-
window.addEventListener('pointermove', onMove);
|
|
7153
|
-
window.addEventListener('pointerup', onUp);
|
|
7154
|
-
window.addEventListener('pointercancel', onUp);
|
|
7155
|
-
}, [handleRangeDragChange]);
|
|
7181
|
+
window.addEventListener('pointermove', onMove, capture);
|
|
7182
|
+
window.addEventListener('pointerup', onUp, capture);
|
|
7183
|
+
window.addEventListener('pointercancel', onUp, capture);
|
|
7184
|
+
}, [handleRangeDragChange, suppressTapToPlayPause]);
|
|
7185
|
+
const onTrackPointerDown = (0,external_react_.useCallback)(event => {
|
|
7186
|
+
if (!interactiveRef.current || event.button > 0 || event.ctrlKey || event.metaKey || isRangeDraggingRef.current || createDragRef.current) {
|
|
7187
|
+
return;
|
|
7188
|
+
}
|
|
7189
|
+
const {
|
|
7190
|
+
target
|
|
7191
|
+
} = event;
|
|
7192
|
+
if (target instanceof Element && target.closest('.bp-WaveformRange-handle, .bp-WaveformRange-comment')) {
|
|
7193
|
+
return;
|
|
7194
|
+
}
|
|
7195
|
+
const drag = rangeCreateDragFromEvent(event, {
|
|
7196
|
+
durationSec: durationSecRef.current,
|
|
7197
|
+
range: rangeRef.current,
|
|
7198
|
+
track: trackRef.current,
|
|
7199
|
+
viewport: viewportRef.current
|
|
7200
|
+
});
|
|
7201
|
+
if (!drag) {
|
|
7202
|
+
return;
|
|
7203
|
+
}
|
|
7204
|
+
if (cameraModeRef.current !== 'tape') {
|
|
7205
|
+
startRangeCreateDrag(drag, false);
|
|
7206
|
+
return;
|
|
7207
|
+
}
|
|
7208
|
+
const suppressContextMenu = menuEvent => {
|
|
7209
|
+
menuEvent.preventDefault();
|
|
7210
|
+
};
|
|
7211
|
+
let endPointer = () => undefined;
|
|
7212
|
+
const removeContextMenu = () => {
|
|
7213
|
+
window.removeEventListener('contextmenu', suppressContextMenu, true);
|
|
7214
|
+
window.removeEventListener('pointerup', endPointer, true);
|
|
7215
|
+
window.removeEventListener('pointercancel', endPointer, true);
|
|
7216
|
+
if (removeTapeContextMenuRef.current === removeContextMenu) {
|
|
7217
|
+
removeTapeContextMenuRef.current = null;
|
|
7218
|
+
}
|
|
7219
|
+
};
|
|
7220
|
+
endPointer = endEvent => {
|
|
7221
|
+
if (endEvent.pointerId !== drag.pointerId) {
|
|
7222
|
+
return;
|
|
7223
|
+
}
|
|
7224
|
+
removeContextMenu();
|
|
7225
|
+
};
|
|
7226
|
+
removeTapeContextMenuRef.current = removeContextMenu;
|
|
7227
|
+
window.addEventListener('contextmenu', suppressContextMenu, true);
|
|
7228
|
+
window.addEventListener('pointerup', endPointer, true);
|
|
7229
|
+
window.addEventListener('pointercancel', endPointer, true);
|
|
7230
|
+
const originY = event.clientY;
|
|
7231
|
+
let holdPending = true;
|
|
7232
|
+
let longPressTimer = 0;
|
|
7233
|
+
let onHoldMove = () => undefined;
|
|
7234
|
+
let onHoldEnd = () => undefined;
|
|
7235
|
+
const cancelHold = () => {
|
|
7236
|
+
if (!holdPending) {
|
|
7237
|
+
return;
|
|
7238
|
+
}
|
|
7239
|
+
holdPending = false;
|
|
7240
|
+
tapeRangeHoldRef.current = false;
|
|
7241
|
+
window.clearTimeout(longPressTimer);
|
|
7242
|
+
window.removeEventListener('pointermove', onHoldMove, true);
|
|
7243
|
+
window.removeEventListener('pointerup', onHoldEnd, true);
|
|
7244
|
+
window.removeEventListener('pointercancel', onHoldEnd, true);
|
|
7245
|
+
if (removeCreateDragListenersRef.current === cancelHold) {
|
|
7246
|
+
removeCreateDragListenersRef.current = null;
|
|
7247
|
+
}
|
|
7248
|
+
};
|
|
7249
|
+
onHoldMove = moveEvent => {
|
|
7250
|
+
if (!holdPending || moveEvent.pointerId !== drag.pointerId) {
|
|
7251
|
+
return;
|
|
7252
|
+
}
|
|
7253
|
+
const moved = Math.hypot(moveEvent.clientX - drag.originX, moveEvent.clientY - originY);
|
|
7254
|
+
if (moved >= constants/* WAVEFORM_TAPE_RANGE_LONG_PRESS_CANCEL_PX */.Oe) {
|
|
7255
|
+
cancelHold();
|
|
7256
|
+
return;
|
|
7257
|
+
}
|
|
7258
|
+
// A smaller drift must not scroll the tape. The move that cancels the hold stays a swipe.
|
|
7259
|
+
moveEvent.preventDefault();
|
|
7260
|
+
moveEvent.stopPropagation();
|
|
7261
|
+
};
|
|
7262
|
+
onHoldEnd = upEvent => {
|
|
7263
|
+
if (upEvent.pointerId !== drag.pointerId) {
|
|
7264
|
+
return;
|
|
7265
|
+
}
|
|
7266
|
+
cancelHold();
|
|
7267
|
+
};
|
|
7268
|
+
tapeRangeHoldRef.current = true;
|
|
7269
|
+
longPressTimer = window.setTimeout(() => {
|
|
7270
|
+
if (!holdPending) {
|
|
7271
|
+
return;
|
|
7272
|
+
}
|
|
7273
|
+
cancelHold();
|
|
7274
|
+
suppressTapToPlayPause();
|
|
7275
|
+
startRangeCreateDrag(drag, true);
|
|
7276
|
+
}, constants/* WAVEFORM_TAPE_RANGE_LONG_PRESS_MS */.RQ);
|
|
7277
|
+
removeCreateDragListenersRef.current = cancelHold;
|
|
7278
|
+
window.addEventListener('pointermove', onHoldMove, true);
|
|
7279
|
+
window.addEventListener('pointerup', onHoldEnd, true);
|
|
7280
|
+
window.addEventListener('pointercancel', onHoldEnd, true);
|
|
7281
|
+
}, [suppressTapToPlayPause, startRangeCreateDrag]);
|
|
7156
7282
|
const bindOverlayPortalHost = (0,external_react_.useCallback)(node => {
|
|
7157
7283
|
const host = node?.parentElement ?? null;
|
|
7158
7284
|
setOverlayPortalHost(prev => prev === host ? prev : host);
|
|
@@ -7790,7 +7916,9 @@ function isFpsAvailable(player) {
|
|
|
7790
7916
|
/* harmony export */ Lu: () => (/* binding */ WAVEFORM_BAR_GAP),
|
|
7791
7917
|
/* harmony export */ MR: () => (/* binding */ WAVEFORM_RANGE_EDGE_ZONE_PX),
|
|
7792
7918
|
/* harmony export */ NM: () => (/* binding */ WAVEFORM_FOLLOW_INSET_PX),
|
|
7919
|
+
/* harmony export */ Oe: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_CANCEL_PX),
|
|
7793
7920
|
/* harmony export */ QD: () => (/* binding */ WAVEFORM_ZOOM_BUTTON_STEP),
|
|
7921
|
+
/* harmony export */ RQ: () => (/* binding */ WAVEFORM_TAPE_RANGE_LONG_PRESS_MS),
|
|
7794
7922
|
/* harmony export */ VS: () => (/* binding */ WAVEFORM_RANGE_EDGE_SCROLL_AUDIO_SEC_PER_SEC),
|
|
7795
7923
|
/* harmony export */ XS: () => (/* binding */ WAVEFORM_BAR_MIN_HEIGHT),
|
|
7796
7924
|
/* harmony export */ Zs: () => (/* binding */ WAVEFORM_FOLLOW_SCROLL_SETTLE_MS),
|
|
@@ -7878,6 +8006,10 @@ const WAVEFORM_RANGE_SNAP_PX = 8;
|
|
|
7878
8006
|
const WAVEFORM_RANGE_MIN_DURATION_MS = 250;
|
|
7879
8007
|
/** Pointer travel before a waveform press becomes a new draft range. Shorter presses stay click-to-seek. */
|
|
7880
8008
|
const WAVEFORM_RANGE_CREATE_DRAG_PX = 4;
|
|
8009
|
+
/** Hold on the tape waveform before a press can draw a new range. A move sooner stays a swipe. */
|
|
8010
|
+
const WAVEFORM_TAPE_RANGE_LONG_PRESS_MS = 500;
|
|
8011
|
+
/** Pointer travel during that hold that cancels it. */
|
|
8012
|
+
const WAVEFORM_TAPE_RANGE_LONG_PRESS_CANCEL_PX = 10;
|
|
7881
8013
|
/** Drag a handle inside this many CSS pixels of either view edge and the tape scrolls. */
|
|
7882
8014
|
const WAVEFORM_RANGE_EDGE_ZONE_PX = 100;
|
|
7883
8015
|
/** Audio seconds moved per wall-clock second when the pointer is on the view edge. */
|
|
@@ -24968,7 +25100,7 @@ class Browser {
|
|
|
24968
25100
|
;// ./src/lib/Logger.js
|
|
24969
25101
|
/* eslint-disable no-undef */
|
|
24970
25102
|
const CLIENT_NAME = "box-content-preview";
|
|
24971
|
-
const CLIENT_VERSION = "3.
|
|
25103
|
+
const CLIENT_VERSION = "3.101.0";
|
|
24972
25104
|
/* eslint-enable no-undef */
|
|
24973
25105
|
|
|
24974
25106
|
class Logger {
|
|
@@ -25842,7 +25974,7 @@ class RepStatus extends (events_default()) {
|
|
|
25842
25974
|
// If changes are made to this file to support more extensions that are "highlightable", then make sure to
|
|
25843
25975
|
// check if we need to upgrade the highlightjs custom build to add language grammar for that new extension language.
|
|
25844
25976
|
// See build/upgrade_highlightjs.sh
|
|
25845
|
-
const NON_CODE_EXTENSIONS = ['csv', 'log', 'md', 'tsv', 'txt'];
|
|
25977
|
+
const NON_CODE_EXTENSIONS = ['csv', 'log', 'md', 'tsv', 'txt', 'vtt'];
|
|
25846
25978
|
const HTML_EXTENSIONS = ['htm', 'html', 'xhtml', 'xml', 'xsd', 'xsl']; // These types do not have an appropriate extracted text representation for preview
|
|
25847
25979
|
|
|
25848
25980
|
const CODE_EXTENSIONS = ['as', 'as3', 'asm', 'bat', 'c', 'cc', 'cmake', 'cpp', 'cs', 'css', 'cxx', 'diff', 'erb', 'groovy', 'h', 'haml', 'hh', 'java', 'js', 'json', 'less', 'm', 'make', 'ml', 'mm', 'php', 'pl', 'plist', 'properties', 'py', 'rb', 'rst', 'sass', 'scala', 'script', 'scm', 'sml', 'sql', 'sh', 'vi', 'vim', 'webdoc', 'yaml'];
|