@waveform-playlist/ui-components 9.1.0 → 9.1.2
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +22 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -375,10 +375,10 @@ declare const PlayheadWithMarker: react__default.FC<PlayheadProps>;
|
|
|
375
375
|
|
|
376
376
|
interface PlaylistProps {
|
|
377
377
|
readonly theme: DefaultTheme;
|
|
378
|
-
readonly children?:
|
|
378
|
+
readonly children?: react__default.ReactNode;
|
|
379
379
|
readonly backgroundColor?: string;
|
|
380
380
|
readonly timescaleBackgroundColor?: string;
|
|
381
|
-
readonly timescale?:
|
|
381
|
+
readonly timescale?: react__default.ReactElement;
|
|
382
382
|
readonly timescaleWidth?: number;
|
|
383
383
|
readonly tracksWidth?: number;
|
|
384
384
|
readonly controlsWidth?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -375,10 +375,10 @@ declare const PlayheadWithMarker: react__default.FC<PlayheadProps>;
|
|
|
375
375
|
|
|
376
376
|
interface PlaylistProps {
|
|
377
377
|
readonly theme: DefaultTheme;
|
|
378
|
-
readonly children?:
|
|
378
|
+
readonly children?: react__default.ReactNode;
|
|
379
379
|
readonly backgroundColor?: string;
|
|
380
380
|
readonly timescaleBackgroundColor?: string;
|
|
381
|
-
readonly timescale?:
|
|
381
|
+
readonly timescale?: react__default.ReactElement;
|
|
382
382
|
readonly timescaleWidth?: number;
|
|
383
383
|
readonly tracksWidth?: number;
|
|
384
384
|
readonly controlsWidth?: number;
|
package/dist/index.js
CHANGED
|
@@ -1214,6 +1214,7 @@ var FadeOverlay = ({
|
|
|
1214
1214
|
};
|
|
1215
1215
|
|
|
1216
1216
|
// src/components/Clip.tsx
|
|
1217
|
+
var import_core2 = require("@waveform-playlist/core");
|
|
1217
1218
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1218
1219
|
var ClipContainer = import_styled_components13.default.div.attrs((props) => ({
|
|
1219
1220
|
style: props.$isOverlay ? {} : {
|
|
@@ -1227,13 +1228,8 @@ var ClipContainer = import_styled_components13.default.div.attrs((props) => ({
|
|
|
1227
1228
|
width: ${(props) => props.$isOverlay ? `${props.$width}px` : "auto"};
|
|
1228
1229
|
display: flex;
|
|
1229
1230
|
flex-direction: column;
|
|
1230
|
-
background: rgba(255, 255, 255, 0.05);
|
|
1231
1231
|
z-index: 10; /* Above progress overlay (z-index: 2) but below controls/playhead */
|
|
1232
1232
|
pointer-events: none; /* Let clicks pass through to ClickOverlay for playhead positioning */
|
|
1233
|
-
|
|
1234
|
-
&:hover {
|
|
1235
|
-
background: rgba(255, 255, 255, 0.08);
|
|
1236
|
-
}
|
|
1237
1233
|
`;
|
|
1238
1234
|
var ChannelsWrapper = import_styled_components13.default.div`
|
|
1239
1235
|
flex: 1;
|
|
@@ -1263,8 +1259,7 @@ var Clip = ({
|
|
|
1263
1259
|
touchOptimized = false
|
|
1264
1260
|
}) => {
|
|
1265
1261
|
const left = Math.floor(startSample / samplesPerPixel);
|
|
1266
|
-
const
|
|
1267
|
-
const width = endPixel - left;
|
|
1262
|
+
const width = (0, import_core2.clipPixelWidth)(startSample, durationSamples, samplesPerPixel);
|
|
1268
1263
|
const enableDrag = showHeader && !disableHeaderDrag && !isOverlay;
|
|
1269
1264
|
const draggableId = `clip-${trackIndex}-${clipIndex}`;
|
|
1270
1265
|
const {
|
|
@@ -1416,7 +1411,7 @@ var MasterVolumeControl = ({
|
|
|
1416
1411
|
// src/components/PianoRollChannel.tsx
|
|
1417
1412
|
var import_react8 = require("react");
|
|
1418
1413
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1419
|
-
var
|
|
1414
|
+
var import_core3 = require("@waveform-playlist/core");
|
|
1420
1415
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1421
1416
|
var NoteCanvas = import_styled_components15.default.canvas.attrs((props) => ({
|
|
1422
1417
|
style: {
|
|
@@ -1459,7 +1454,7 @@ var PianoRollChannel = ({
|
|
|
1459
1454
|
}) => {
|
|
1460
1455
|
const { canvasRef, canvasMapRef } = useChunkedCanvasRefs();
|
|
1461
1456
|
const clipOriginX = useClipViewportOrigin();
|
|
1462
|
-
const visibleChunkIndices = useVisibleChunkIndices(length,
|
|
1457
|
+
const visibleChunkIndices = useVisibleChunkIndices(length, import_core3.MAX_CANVAS_WIDTH, clipOriginX);
|
|
1463
1458
|
const { minMidi, maxMidi } = (0, import_react8.useMemo)(() => {
|
|
1464
1459
|
if (midiNotes.length === 0) return { minMidi: 0, maxMidi: 127 };
|
|
1465
1460
|
let min = 127, max = 0;
|
|
@@ -1476,7 +1471,7 @@ var PianoRollChannel = ({
|
|
|
1476
1471
|
const noteHeight = Math.max(2, waveHeight / noteRange);
|
|
1477
1472
|
const pixelsPerSecond = sampleRate / samplesPerPixel;
|
|
1478
1473
|
for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
|
|
1479
|
-
const chunkPixelStart = canvasIdx *
|
|
1474
|
+
const chunkPixelStart = canvasIdx * import_core3.MAX_CANVAS_WIDTH;
|
|
1480
1475
|
const canvasWidth = canvas.width / devicePixelRatio;
|
|
1481
1476
|
const ctx = canvas.getContext("2d");
|
|
1482
1477
|
if (!ctx) continue;
|
|
@@ -1522,8 +1517,8 @@ var PianoRollChannel = ({
|
|
|
1522
1517
|
index
|
|
1523
1518
|
]);
|
|
1524
1519
|
const canvases = visibleChunkIndices.map((i) => {
|
|
1525
|
-
const chunkLeft = i *
|
|
1526
|
-
const currentWidth = Math.min(length - chunkLeft,
|
|
1520
|
+
const chunkLeft = i * import_core3.MAX_CANVAS_WIDTH;
|
|
1521
|
+
const currentWidth = Math.min(length - chunkLeft, import_core3.MAX_CANVAS_WIDTH);
|
|
1527
1522
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1528
1523
|
NoteCanvas,
|
|
1529
1524
|
{
|
|
@@ -2145,7 +2140,7 @@ function clockFormat(seconds, decimals) {
|
|
|
2145
2140
|
const hours = Math.floor(seconds / 3600) % 24;
|
|
2146
2141
|
const minutes = Math.floor(seconds / 60) % 60;
|
|
2147
2142
|
const secs = (seconds % 60).toFixed(decimals);
|
|
2148
|
-
return String(hours).padStart(2, "0") + ":" + String(minutes).padStart(2, "0") + ":" + secs.padStart(decimals + 3, "0");
|
|
2143
|
+
return String(hours).padStart(2, "0") + ":" + String(minutes).padStart(2, "0") + ":" + secs.padStart(decimals > 0 ? decimals + 3 : 2, "0");
|
|
2149
2144
|
}
|
|
2150
2145
|
function formatTime(seconds, format) {
|
|
2151
2146
|
switch (format) {
|
|
@@ -2385,7 +2380,7 @@ var usePlayoutStatusUpdate = () => (0, import_react18.useContext)(PlayoutStatusU
|
|
|
2385
2380
|
// src/components/SpectrogramChannel.tsx
|
|
2386
2381
|
var import_react19 = require("react");
|
|
2387
2382
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
2388
|
-
var
|
|
2383
|
+
var import_core4 = require("@waveform-playlist/core");
|
|
2389
2384
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2390
2385
|
var LINEAR_FREQUENCY_SCALE = (f, minF, maxF) => (f - minF) / (maxF - minF);
|
|
2391
2386
|
var Wrapper4 = import_styled_components21.default.div.attrs((props) => ({
|
|
@@ -2444,7 +2439,7 @@ var SpectrogramChannel = ({
|
|
|
2444
2439
|
const onCanvasesReadyRef = (0, import_react19.useRef)(onCanvasesReady);
|
|
2445
2440
|
const isWorkerMode = !!(workerApi && clipId);
|
|
2446
2441
|
const clipOriginX = useClipViewportOrigin();
|
|
2447
|
-
const visibleChunkIndices = useVisibleChunkIndices(length,
|
|
2442
|
+
const visibleChunkIndices = useVisibleChunkIndices(length, import_core4.MAX_CANVAS_WIDTH, clipOriginX);
|
|
2448
2443
|
const lut = colorLUT ?? DEFAULT_COLOR_LUT;
|
|
2449
2444
|
const maxF = maxFrequency ?? (data ? data.sampleRate / 2 : 22050);
|
|
2450
2445
|
const scaleFn = frequencyScaleFn ?? LINEAR_FREQUENCY_SCALE;
|
|
@@ -2510,10 +2505,10 @@ var SpectrogramChannel = ({
|
|
|
2510
2505
|
const match = id.match(/chunk(\d+)$/);
|
|
2511
2506
|
if (!match) {
|
|
2512
2507
|
console.warn(`[spectrogram] Unexpected canvas ID format: ${id}`);
|
|
2513
|
-
return
|
|
2508
|
+
return import_core4.MAX_CANVAS_WIDTH;
|
|
2514
2509
|
}
|
|
2515
2510
|
const chunkIdx = parseInt(match[1], 10);
|
|
2516
|
-
return Math.min(length - chunkIdx *
|
|
2511
|
+
return Math.min(length - chunkIdx * import_core4.MAX_CANVAS_WIDTH, import_core4.MAX_CANVAS_WIDTH);
|
|
2517
2512
|
});
|
|
2518
2513
|
onCanvasesReadyRef.current?.(allIds, allWidths);
|
|
2519
2514
|
}
|
|
@@ -2545,7 +2540,7 @@ var SpectrogramChannel = ({
|
|
|
2545
2540
|
const rangeDb = rawRangeDb === 0 ? 1 : rawRangeDb;
|
|
2546
2541
|
const binToFreq = (bin) => bin / frequencyBinCount * (sampleRate / 2);
|
|
2547
2542
|
for (const [canvasIdx, canvas] of canvasMapRef.current.entries()) {
|
|
2548
|
-
const globalPixelOffset = canvasIdx *
|
|
2543
|
+
const globalPixelOffset = canvasIdx * import_core4.MAX_CANVAS_WIDTH;
|
|
2549
2544
|
const ctx = canvas.getContext("2d");
|
|
2550
2545
|
if (!ctx) continue;
|
|
2551
2546
|
const canvasWidth = canvas.width / devicePixelRatio;
|
|
@@ -2621,8 +2616,8 @@ var SpectrogramChannel = ({
|
|
|
2621
2616
|
visibleChunkIndices
|
|
2622
2617
|
]);
|
|
2623
2618
|
const canvases = visibleChunkIndices.map((i) => {
|
|
2624
|
-
const chunkLeft = i *
|
|
2625
|
-
const currentWidth = Math.min(length - chunkLeft,
|
|
2619
|
+
const chunkLeft = i * import_core4.MAX_CANVAS_WIDTH;
|
|
2620
|
+
const currentWidth = Math.min(length - chunkLeft, import_core4.MAX_CANVAS_WIDTH);
|
|
2626
2621
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2627
2622
|
SpectrogramCanvas,
|
|
2628
2623
|
{
|
|
@@ -2919,7 +2914,7 @@ function secondsToPixels(seconds, samplesPerPixel, sampleRate) {
|
|
|
2919
2914
|
}
|
|
2920
2915
|
|
|
2921
2916
|
// src/components/TimeScale.tsx
|
|
2922
|
-
var
|
|
2917
|
+
var import_core5 = require("@waveform-playlist/core");
|
|
2923
2918
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2924
2919
|
function formatTime2(milliseconds) {
|
|
2925
2920
|
const seconds = Math.floor(milliseconds / 1e3);
|
|
@@ -3007,10 +3002,10 @@ var TimeScale = (props) => {
|
|
|
3007
3002
|
renderTimestamp,
|
|
3008
3003
|
timeScaleHeight
|
|
3009
3004
|
]);
|
|
3010
|
-
const visibleChunkIndices = useVisibleChunkIndices(widthX,
|
|
3005
|
+
const visibleChunkIndices = useVisibleChunkIndices(widthX, import_core5.MAX_CANVAS_WIDTH);
|
|
3011
3006
|
const visibleChunks = visibleChunkIndices.map((i) => {
|
|
3012
|
-
const chunkLeft = i *
|
|
3013
|
-
const chunkWidth = Math.min(widthX - chunkLeft,
|
|
3007
|
+
const chunkLeft = i * import_core5.MAX_CANVAS_WIDTH;
|
|
3008
|
+
const chunkWidth = Math.min(widthX - chunkLeft, import_core5.MAX_CANVAS_WIDTH);
|
|
3014
3009
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3015
3010
|
TimeTickChunk,
|
|
3016
3011
|
{
|
|
@@ -3025,14 +3020,14 @@ var TimeScale = (props) => {
|
|
|
3025
3020
|
`timescale-${i}`
|
|
3026
3021
|
);
|
|
3027
3022
|
});
|
|
3028
|
-
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] *
|
|
3029
|
-
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) *
|
|
3023
|
+
const firstChunkLeft = visibleChunkIndices.length > 0 ? visibleChunkIndices[0] * import_core5.MAX_CANVAS_WIDTH : 0;
|
|
3024
|
+
const lastChunkRight = visibleChunkIndices.length > 0 ? (visibleChunkIndices[visibleChunkIndices.length - 1] + 1) * import_core5.MAX_CANVAS_WIDTH : Infinity;
|
|
3030
3025
|
const visibleMarkers = visibleChunkIndices.length > 0 ? timeMarkersWithPositions.filter(({ pix }) => pix >= firstChunkLeft && pix < lastChunkRight).map(({ element }) => element) : timeMarkersWithPositions.map(({ element }) => element);
|
|
3031
3026
|
(0, import_react21.useLayoutEffect)(() => {
|
|
3032
3027
|
for (const [chunkIdx, canvas] of canvasMapRef.current.entries()) {
|
|
3033
3028
|
const ctx = canvas.getContext("2d");
|
|
3034
3029
|
if (!ctx) continue;
|
|
3035
|
-
const chunkLeft = chunkIdx *
|
|
3030
|
+
const chunkLeft = chunkIdx * import_core5.MAX_CANVAS_WIDTH;
|
|
3036
3031
|
const chunkWidth = canvas.width / devicePixelRatio;
|
|
3037
3032
|
ctx.resetTransform();
|
|
3038
3033
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|