@vivix-labs/media-tools 1.0.0-beta → 1.0.0-beta.3
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 +3 -0
- package/dist/assets/detail-E52XPONK.svg +4 -0
- package/dist/assets/edit-JUVJDD5A.svg +6 -0
- package/dist/assets/export-W2OBXZDQ.svg +6 -0
- package/dist/assets/fullscreen-large-MPLIWDMI.svg +6 -0
- package/dist/assets/inter-latin-700-normal-SU5XVJMF.woff2 +0 -0
- package/dist/assets/mute-large-LSZZ44HF.svg +6 -0
- package/dist/assets/pause-large-XEUBL4KC.svg +6 -0
- package/dist/assets/placeholder-audio-EJEBE7OB.svg +11 -0
- package/dist/assets/placeholder-image-NOVXFVRL.svg +10 -0
- package/dist/assets/placeholder-script-LR2GKWKS.svg +7 -0
- package/dist/assets/placeholder-video-ZFOYHYCR.svg +7 -0
- package/dist/assets/play-cover-WQLOHHPZ.svg +5 -0
- package/dist/assets/playback-play-YRMIX5W4.svg +5 -0
- package/dist/assets/playback-play-large-TM3QUJGG.svg +5 -0
- package/dist/assets/volume-large-QNULSJ2I.svg +6 -0
- package/dist/client.bundle.js +344 -79
- package/dist/client.css +380 -45
- package/dist/client.d.ts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/shared.d.ts +3 -0
- package/package.json +3 -3
package/dist/client.bundle.js
CHANGED
|
@@ -178,8 +178,204 @@ import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
178
178
|
|
|
179
179
|
// packages/ui-system/dist/icon.js
|
|
180
180
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
181
|
+
var iconGeometry = {
|
|
182
|
+
add: {
|
|
183
|
+
width: 16,
|
|
184
|
+
height: 16,
|
|
185
|
+
slot: 16
|
|
186
|
+
},
|
|
187
|
+
check: {
|
|
188
|
+
width: 12,
|
|
189
|
+
height: 12,
|
|
190
|
+
slot: 12
|
|
191
|
+
},
|
|
192
|
+
"check-on-content": {
|
|
193
|
+
width: 12,
|
|
194
|
+
height: 12,
|
|
195
|
+
slot: 12
|
|
196
|
+
},
|
|
197
|
+
"chevron-up": {
|
|
198
|
+
width: 12,
|
|
199
|
+
height: 12,
|
|
200
|
+
slot: 12
|
|
201
|
+
},
|
|
202
|
+
expand: {
|
|
203
|
+
width: 16,
|
|
204
|
+
height: 16,
|
|
205
|
+
slot: 16
|
|
206
|
+
},
|
|
207
|
+
"chevron-down": {
|
|
208
|
+
width: 12,
|
|
209
|
+
height: 12,
|
|
210
|
+
slot: 12
|
|
211
|
+
},
|
|
212
|
+
clear: {
|
|
213
|
+
width: 14.5332,
|
|
214
|
+
height: 14.5332,
|
|
215
|
+
slot: 16
|
|
216
|
+
},
|
|
217
|
+
grid: {
|
|
218
|
+
width: 13.2039,
|
|
219
|
+
height: 13.2,
|
|
220
|
+
slot: 16
|
|
221
|
+
},
|
|
222
|
+
list: {
|
|
223
|
+
width: 13.3372,
|
|
224
|
+
height: 12.0039,
|
|
225
|
+
slot: 16
|
|
226
|
+
},
|
|
227
|
+
search: {
|
|
228
|
+
width: 13.2,
|
|
229
|
+
height: 13.2,
|
|
230
|
+
slot: 16
|
|
231
|
+
},
|
|
232
|
+
calendar: {
|
|
233
|
+
width: 16,
|
|
234
|
+
height: 16,
|
|
235
|
+
slot: 16
|
|
236
|
+
},
|
|
237
|
+
import: {
|
|
238
|
+
width: 16,
|
|
239
|
+
height: 16,
|
|
240
|
+
slot: 16
|
|
241
|
+
},
|
|
242
|
+
magic: {
|
|
243
|
+
width: 14.0625,
|
|
244
|
+
height: 15.5625,
|
|
245
|
+
slot: 18
|
|
246
|
+
},
|
|
247
|
+
select: {
|
|
248
|
+
width: 14.6298,
|
|
249
|
+
height: 16.065,
|
|
250
|
+
slot: 18
|
|
251
|
+
},
|
|
252
|
+
area: {
|
|
253
|
+
width: 16.125,
|
|
254
|
+
height: 16.125,
|
|
255
|
+
slot: 18
|
|
256
|
+
},
|
|
257
|
+
draw: {
|
|
258
|
+
width: 16.125,
|
|
259
|
+
height: 16.125,
|
|
260
|
+
slot: 18
|
|
261
|
+
},
|
|
262
|
+
close: {
|
|
263
|
+
width: 18,
|
|
264
|
+
height: 18,
|
|
265
|
+
slot: 18
|
|
266
|
+
},
|
|
267
|
+
reset: {
|
|
268
|
+
width: 16.35,
|
|
269
|
+
height: 16.35,
|
|
270
|
+
slot: 18
|
|
271
|
+
},
|
|
272
|
+
more: {
|
|
273
|
+
width: 16,
|
|
274
|
+
height: 16,
|
|
275
|
+
slot: 16
|
|
276
|
+
},
|
|
277
|
+
play: {
|
|
278
|
+
width: 12.381,
|
|
279
|
+
height: 13.2143,
|
|
280
|
+
slot: 20
|
|
281
|
+
},
|
|
282
|
+
pause: {
|
|
283
|
+
width: 14.1905,
|
|
284
|
+
height: 14.1905,
|
|
285
|
+
slot: 20
|
|
286
|
+
},
|
|
287
|
+
mute: {
|
|
288
|
+
width: 17.5239,
|
|
289
|
+
height: 14.1922,
|
|
290
|
+
slot: 20
|
|
291
|
+
},
|
|
292
|
+
volume: {
|
|
293
|
+
width: 17.5239,
|
|
294
|
+
height: 14.1922,
|
|
295
|
+
slot: 20
|
|
296
|
+
},
|
|
297
|
+
fullscreen: {
|
|
298
|
+
width: 20,
|
|
299
|
+
height: 20,
|
|
300
|
+
slot: 20
|
|
301
|
+
},
|
|
302
|
+
"placeholder-image": {
|
|
303
|
+
width: 20,
|
|
304
|
+
height: 20,
|
|
305
|
+
slot: 20
|
|
306
|
+
},
|
|
307
|
+
"placeholder-video": {
|
|
308
|
+
width: 17.9199,
|
|
309
|
+
height: 16.2506,
|
|
310
|
+
slot: 20
|
|
311
|
+
},
|
|
312
|
+
"placeholder-audio": {
|
|
313
|
+
width: 17.5017,
|
|
314
|
+
height: 17.4992,
|
|
315
|
+
slot: 20
|
|
316
|
+
},
|
|
317
|
+
"placeholder-script": {
|
|
318
|
+
width: 17.0834,
|
|
319
|
+
height: 17.0837,
|
|
320
|
+
slot: 20
|
|
321
|
+
},
|
|
322
|
+
export: {
|
|
323
|
+
width: 11.8667,
|
|
324
|
+
height: 13.2,
|
|
325
|
+
slot: 16
|
|
326
|
+
},
|
|
327
|
+
edit: {
|
|
328
|
+
width: 10.8791,
|
|
329
|
+
height: 12.0459,
|
|
330
|
+
slot: 14
|
|
331
|
+
},
|
|
332
|
+
"play-cover": {
|
|
333
|
+
width: 12.9167,
|
|
334
|
+
height: 13.7501,
|
|
335
|
+
slot: 20
|
|
336
|
+
},
|
|
337
|
+
"playback-play": {
|
|
338
|
+
width: 13.29564,
|
|
339
|
+
height: 14.1905,
|
|
340
|
+
slot: 20
|
|
341
|
+
},
|
|
342
|
+
"playback-play-large": {
|
|
343
|
+
width: 15.95477,
|
|
344
|
+
height: 17.0286,
|
|
345
|
+
slot: 24
|
|
346
|
+
},
|
|
347
|
+
"pause-large": {
|
|
348
|
+
width: 17.0286,
|
|
349
|
+
height: 17.0286,
|
|
350
|
+
slot: 24
|
|
351
|
+
},
|
|
352
|
+
"volume-large": {
|
|
353
|
+
width: 21.02868,
|
|
354
|
+
height: 17.03064,
|
|
355
|
+
slot: 24
|
|
356
|
+
},
|
|
357
|
+
"mute-large": {
|
|
358
|
+
width: 21.0286,
|
|
359
|
+
height: 17.0307,
|
|
360
|
+
slot: 24
|
|
361
|
+
},
|
|
362
|
+
"fullscreen-large": {
|
|
363
|
+
width: 24,
|
|
364
|
+
height: 24,
|
|
365
|
+
slot: 24
|
|
366
|
+
}
|
|
367
|
+
};
|
|
181
368
|
function Icon({ name, size }) {
|
|
182
|
-
|
|
369
|
+
const geometry2 = iconGeometry[name];
|
|
370
|
+
const style = {
|
|
371
|
+
...geometry2 && {
|
|
372
|
+
"--vx-icon-native-size": `${geometry2.slot}px`,
|
|
373
|
+
"--vx-icon-width": `${geometry2.width / geometry2.slot * 100}%`,
|
|
374
|
+
"--vx-icon-height": `${geometry2.height / geometry2.slot * 100}%`
|
|
375
|
+
},
|
|
376
|
+
...size === void 0 ? {} : { "--vx-icon-size": `${size}px` }
|
|
377
|
+
};
|
|
378
|
+
return _jsx("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style });
|
|
183
379
|
}
|
|
184
380
|
|
|
185
381
|
// packages/ui-system/dist/button-variants.js
|
|
@@ -239,8 +435,8 @@ function SegmentedControl({ label, items, value, onValueChange, size = "medium",
|
|
|
239
435
|
|
|
240
436
|
// packages/ui-system/dist/tag.js
|
|
241
437
|
import { jsx as _jsx4 } from "react/jsx-runtime";
|
|
242
|
-
function Tag({ children, variant = "overlay" }) {
|
|
243
|
-
return _jsx4("span", { className: "vx-tag", "data-variant": variant, children });
|
|
438
|
+
function Tag({ children, variant = "overlay", className }) {
|
|
439
|
+
return _jsx4("span", { className: className ? `vx-tag ${className}` : "vx-tag", "data-variant": variant, children });
|
|
244
440
|
}
|
|
245
441
|
|
|
246
442
|
// packages/ui-system/dist/frame-range.js
|
|
@@ -298,41 +494,104 @@ function FrameRange({ duration, thumbnail, value, step = 0.1, variant = "range",
|
|
|
298
494
|
}
|
|
299
495
|
|
|
300
496
|
// packages/ui-system/dist/dialog.js
|
|
301
|
-
import { jsx as _jsx6, jsxs as _jsxs4 } from "react/jsx-runtime";
|
|
302
|
-
import {
|
|
303
|
-
|
|
497
|
+
import { jsx as _jsx6, jsxs as _jsxs4, Fragment as _Fragment2 } from "react/jsx-runtime";
|
|
498
|
+
import { useId as useId2, useLayoutEffect, useRef, useState } from "react";
|
|
499
|
+
import { createPortal } from "react-dom";
|
|
500
|
+
|
|
501
|
+
// packages/ui-system/dist/dialog-surface.js
|
|
502
|
+
function createDialogSurface(anchor) {
|
|
503
|
+
const source = anchor.ownerDocument;
|
|
504
|
+
let target;
|
|
505
|
+
try {
|
|
506
|
+
target = source.defaultView?.top?.document ?? source;
|
|
507
|
+
} catch {
|
|
508
|
+
return void 0;
|
|
509
|
+
}
|
|
510
|
+
if (target === source)
|
|
511
|
+
return void 0;
|
|
512
|
+
const host = target.createElement("div");
|
|
513
|
+
host.dataset.studioDialogSurface = "";
|
|
514
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
515
|
+
for (const original of source.querySelectorAll('link[rel="stylesheet"], style')) {
|
|
516
|
+
const clone = original.cloneNode(true);
|
|
517
|
+
if (original.tagName === "LINK")
|
|
518
|
+
clone.setAttribute("href", original.href);
|
|
519
|
+
shadow.append(clone);
|
|
520
|
+
}
|
|
521
|
+
const theme = anchor.closest("[data-vx-theme]");
|
|
522
|
+
const root = target.createElement("div");
|
|
523
|
+
root.dataset.vxTheme = theme?.dataset.vxTheme ?? "light";
|
|
524
|
+
root.className = theme?.className ?? "";
|
|
525
|
+
root.style.display = "contents";
|
|
526
|
+
const style = source.defaultView.getComputedStyle(anchor);
|
|
527
|
+
for (const name of style)
|
|
528
|
+
if (name.startsWith("--"))
|
|
529
|
+
root.style.setProperty(name, style.getPropertyValue(name));
|
|
530
|
+
shadow.append(root);
|
|
531
|
+
let container = root;
|
|
532
|
+
const ancestors = [];
|
|
533
|
+
for (let parent = anchor.parentElement; parent && parent !== theme; parent = parent.parentElement)
|
|
534
|
+
ancestors.unshift(parent);
|
|
535
|
+
for (const original of ancestors) {
|
|
536
|
+
const wrapper = target.createElement("div");
|
|
537
|
+
wrapper.className = original.className;
|
|
538
|
+
for (const { name, value } of original.attributes)
|
|
539
|
+
if (name.startsWith("data-"))
|
|
540
|
+
wrapper.setAttribute(name, value);
|
|
541
|
+
wrapper.style.display = "contents";
|
|
542
|
+
container.append(wrapper);
|
|
543
|
+
container = wrapper;
|
|
544
|
+
}
|
|
545
|
+
target.body.append(host);
|
|
546
|
+
return { root: container, dispose: () => host.remove() };
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// packages/ui-system/dist/dialog.js
|
|
550
|
+
function Dialog({ title, open, onOpenChange, children, actions, className, variant = "default" }) {
|
|
304
551
|
const ref = useRef(null);
|
|
552
|
+
const anchor = useRef(null);
|
|
553
|
+
const [surface, setSurface] = useState();
|
|
305
554
|
const heading = useId2();
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if (!dialog || dialog.open === open)
|
|
555
|
+
useLayoutEffect(() => {
|
|
556
|
+
if (!open || !anchor.current)
|
|
309
557
|
return;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
558
|
+
const mounted = createDialogSurface(anchor.current);
|
|
559
|
+
const active = anchor.current.getRootNode().activeElement;
|
|
560
|
+
setSurface(mounted?.root ?? null);
|
|
561
|
+
return () => {
|
|
562
|
+
mounted?.dispose();
|
|
563
|
+
setSurface(void 0);
|
|
564
|
+
queueMicrotask(() => {
|
|
565
|
+
if (active?.isConnected)
|
|
566
|
+
active.focus();
|
|
567
|
+
});
|
|
568
|
+
};
|
|
314
569
|
}, [open]);
|
|
315
570
|
useLayoutEffect(() => {
|
|
316
|
-
const
|
|
571
|
+
const dialog2 = ref.current;
|
|
572
|
+
if (!open || surface === void 0 || !dialog2)
|
|
573
|
+
return;
|
|
574
|
+
dialog2.showModal();
|
|
317
575
|
return () => {
|
|
318
|
-
if (
|
|
319
|
-
|
|
576
|
+
if (dialog2.open)
|
|
577
|
+
dialog2.close();
|
|
320
578
|
};
|
|
321
|
-
}, []);
|
|
322
|
-
|
|
579
|
+
}, [open, surface]);
|
|
580
|
+
const dialog = _jsxs4("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "data-variant": variant === "default" ? void 0 : variant, "aria-labelledby": heading, onCancel: (event) => {
|
|
323
581
|
event.preventDefault();
|
|
324
582
|
event.stopPropagation();
|
|
325
583
|
onOpenChange(false);
|
|
326
584
|
}, onClose: (event) => {
|
|
327
|
-
if (open && !event.currentTarget.open)
|
|
585
|
+
if (open && event.currentTarget.isConnected && !event.currentTarget.open)
|
|
328
586
|
onOpenChange(false);
|
|
329
587
|
}, children: [_jsxs4("header", { children: [_jsx6("h2", { id: heading, children: title }), _jsx6(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) })] }), _jsx6("div", { className: "vx-dialog-body", children }), actions && _jsx6("footer", { children: actions })] });
|
|
588
|
+
return _jsxs4(_Fragment2, { children: [_jsx6("span", { ref: anchor, hidden: true }), open && (surface ? createPortal(dialog, surface) : dialog)] });
|
|
330
589
|
}
|
|
331
590
|
|
|
332
591
|
// packages/ui-system/dist/menu.js
|
|
333
592
|
import { jsx as _jsx7, jsxs as _jsxs5 } from "react/jsx-runtime";
|
|
334
|
-
import { useEffect
|
|
335
|
-
import { createPortal } from "react-dom";
|
|
593
|
+
import { useEffect, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
594
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
336
595
|
function isEnabled(item) {
|
|
337
596
|
return !item.disabled && item.items?.length !== 0;
|
|
338
597
|
}
|
|
@@ -341,9 +600,9 @@ function Menu({ label, items, triggerIcon, floating = false }) {
|
|
|
341
600
|
const trigger = useRef2(null);
|
|
342
601
|
const popup = useRef2(null);
|
|
343
602
|
const focusIndex = useRef2(0);
|
|
344
|
-
const [path, setPath] =
|
|
345
|
-
const [placement, setPlacement] =
|
|
346
|
-
const portalRoot = floating ? trigger.current?.closest("[data-vx-theme]") : null;
|
|
603
|
+
const [path, setPath] = useState2(null);
|
|
604
|
+
const [placement, setPlacement] = useState2({ visibility: "hidden" });
|
|
605
|
+
const portalRoot = floating ? trigger.current?.closest("dialog, [data-vx-theme]") : null;
|
|
347
606
|
useLayoutEffect2(() => {
|
|
348
607
|
if (!floating || !path || !portalRoot)
|
|
349
608
|
return;
|
|
@@ -351,8 +610,10 @@ function Menu({ label, items, triggerIcon, floating = false }) {
|
|
|
351
610
|
const anchor = trigger.current, menu2 = popup.current;
|
|
352
611
|
if (!anchor || !menu2)
|
|
353
612
|
return;
|
|
613
|
+
const document3 = anchor.ownerDocument;
|
|
614
|
+
const window2 = document3.defaultView;
|
|
354
615
|
const rect = anchor.getBoundingClientRect();
|
|
355
|
-
const width =
|
|
616
|
+
const width = document3.documentElement.clientWidth, height = window2.innerHeight;
|
|
356
617
|
const bounds = menu2.getBoundingClientRect();
|
|
357
618
|
const naturalHeight = menu2.scrollHeight + bounds.height - menu2.clientHeight;
|
|
358
619
|
const below = Math.max(0, height - rect.bottom - 12), above = Math.max(0, rect.top - 12);
|
|
@@ -370,18 +631,20 @@ function Menu({ label, items, triggerIcon, floating = false }) {
|
|
|
370
631
|
});
|
|
371
632
|
};
|
|
372
633
|
const outside = (event) => {
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
634
|
+
const path2 = event.composedPath();
|
|
635
|
+
if (!path2.includes(trigger.current) && !path2.includes(popup.current))
|
|
375
636
|
setPath(null);
|
|
376
637
|
};
|
|
638
|
+
const document2 = portalRoot.ownerDocument;
|
|
639
|
+
const window = document2.defaultView;
|
|
377
640
|
position();
|
|
378
641
|
window.addEventListener("resize", position);
|
|
379
642
|
window.addEventListener("scroll", position, true);
|
|
380
|
-
|
|
643
|
+
document2.addEventListener("pointerdown", outside);
|
|
381
644
|
return () => {
|
|
382
645
|
window.removeEventListener("resize", position);
|
|
383
646
|
window.removeEventListener("scroll", position, true);
|
|
384
|
-
|
|
647
|
+
document2.removeEventListener("pointerdown", outside);
|
|
385
648
|
};
|
|
386
649
|
}, [floating, path, portalRoot]);
|
|
387
650
|
let entries = items;
|
|
@@ -396,7 +659,7 @@ function Menu({ label, items, triggerIcon, floating = false }) {
|
|
|
396
659
|
function buttons() {
|
|
397
660
|
return [...popup.current?.querySelectorAll("button:not(:disabled)") ?? []];
|
|
398
661
|
}
|
|
399
|
-
|
|
662
|
+
useEffect(() => {
|
|
400
663
|
if (path && (!floating || !portalRoot || placement.visibility === "visible"))
|
|
401
664
|
buttons().at(focusIndex.current)?.focus();
|
|
402
665
|
}, [path, floating && placement.visibility, portalRoot]);
|
|
@@ -478,18 +741,20 @@ function Menu({ label, items, triggerIcon, floating = false }) {
|
|
|
478
741
|
return _jsxs5("div", { className: "vx-action-menu", onBlur: (event) => {
|
|
479
742
|
if (!event.currentTarget.contains(event.relatedTarget) && !(floating && popup.current?.contains(event.relatedTarget)))
|
|
480
743
|
setPath(null);
|
|
481
|
-
}, children: [triggerIcon ? _jsx7(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx7(Button, { ref: trigger, label, variant: "text-tonal-sm", trailingIcon: "chevron-down", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ?
|
|
744
|
+
}, children: [triggerIcon ? _jsx7(IconButton, { ref: trigger, label, icon: triggerIcon, variant: "icon-ghost-sm", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }) : _jsx7(Button, { ref: trigger, label, variant: "text-tonal-sm", trailingIcon: "chevron-down", "aria-haspopup": "menu", "aria-controls": id, "aria-expanded": path !== null, disabled: !items.some(isEnabled), onClick: () => path ? close() : open(), onKeyDown: triggerKey }), portalRoot ? createPortal2(menu, portalRoot) : menu] });
|
|
482
745
|
}
|
|
483
746
|
|
|
484
747
|
// packages/ui-system/dist/video-player.js
|
|
485
748
|
import { jsx as _jsx8, jsxs as _jsxs6 } from "react/jsx-runtime";
|
|
486
|
-
import { useEffect as
|
|
749
|
+
import { useEffect as useEffect2, useRef as useRef3, useState as useState3 } from "react";
|
|
487
750
|
function timeLabel2(seconds) {
|
|
488
751
|
const whole = Math.floor(seconds);
|
|
489
752
|
return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
|
|
490
753
|
}
|
|
491
754
|
function PlaybackControls({ playing, muted, time, duration, size = "medium", disabled, onTogglePlay, onToggleMute, onSeek, onFullscreen }) {
|
|
492
|
-
return _jsxs6("div", { className: "vx-playback-controls", role: "group", "aria-label": "Playback controls", "data-size": size,
|
|
755
|
+
return _jsxs6("div", { className: "vx-playback-controls", role: "group", "aria-label": "Playback controls", "data-size": size, style: {
|
|
756
|
+
"--vx-playback-progress": `${duration > 0 ? Math.min(100, Math.max(0, time / duration * 100)) : 0}%`
|
|
757
|
+
}, children: [_jsx8(IconButton, { icon: playing ? size === "large" ? "pause-large" : "pause" : size === "large" ? "playback-play-large" : "playback-play", label: playing ? "Pause" : "Play", disabled, onClick: onTogglePlay }), _jsx8("input", { "aria-label": "Playback position", "aria-valuetext": `${timeLabel2(time)} of ${timeLabel2(duration)}`, type: "range", min: 0, max: duration, value: time, step: "any", disabled: disabled || !duration, onChange: (event) => onSeek(event.currentTarget.valueAsNumber) }), _jsxs6("span", { "aria-hidden": "true", children: [timeLabel2(time), " / ", timeLabel2(duration)] }), _jsx8(IconButton, { icon: muted ? size === "large" ? "mute-large" : "mute" : size === "large" ? "volume-large" : "volume", label: muted ? "Unmute" : "Mute", disabled, onClick: onToggleMute }), onFullscreen && _jsx8(IconButton, { icon: size === "large" ? "fullscreen-large" : "fullscreen", label: "Toggle fullscreen", onClick: onFullscreen })] });
|
|
493
758
|
}
|
|
494
759
|
function VideoPlayer(props) {
|
|
495
760
|
return _jsx8(Playback, { ...props }, JSON.stringify([props.src, props.poster, props.posterDuration]));
|
|
@@ -499,13 +764,13 @@ function Playback({ src, poster, posterDuration = 0, title, version, durationLab
|
|
|
499
764
|
const video = useRef3(null);
|
|
500
765
|
const position = useRef3(0);
|
|
501
766
|
const callbacks = useRef3({ onTimeChange, onStateChange, onEnded });
|
|
502
|
-
const [time, setTime] =
|
|
503
|
-
const [metadataDuration, setMetadataDuration] =
|
|
504
|
-
const [state, setState] =
|
|
505
|
-
const [muted, setMuted] =
|
|
767
|
+
const [time, setTime] = useState3(0);
|
|
768
|
+
const [metadataDuration, setMetadataDuration] = useState3(0);
|
|
769
|
+
const [state, setState] = useState3("cover");
|
|
770
|
+
const [muted, setMuted] = useState3(defaultMuted);
|
|
506
771
|
const stillDuration = poster && Number.isFinite(posterDuration) ? Math.max(0, posterDuration) : 0;
|
|
507
772
|
const duration = src ? metadataDuration : stillDuration;
|
|
508
|
-
|
|
773
|
+
useEffect2(() => {
|
|
509
774
|
const element = video.current;
|
|
510
775
|
return () => {
|
|
511
776
|
if (!element)
|
|
@@ -524,10 +789,10 @@ function Playback({ src, poster, posterDuration = 0, title, version, durationLab
|
|
|
524
789
|
setState(next);
|
|
525
790
|
onStateChange?.(next);
|
|
526
791
|
}
|
|
527
|
-
|
|
792
|
+
useEffect2(() => {
|
|
528
793
|
callbacks.current = { onTimeChange, onStateChange, onEnded };
|
|
529
794
|
}, [onTimeChange, onStateChange, onEnded]);
|
|
530
|
-
|
|
795
|
+
useEffect2(() => {
|
|
531
796
|
if (src || state !== "playing" || !duration)
|
|
532
797
|
return;
|
|
533
798
|
let previous = performance.now();
|
|
@@ -585,13 +850,13 @@ function Playback({ src, poster, posterDuration = 0, title, version, durationLab
|
|
|
585
850
|
onError?.(error);
|
|
586
851
|
}
|
|
587
852
|
}
|
|
588
|
-
return _jsxs6("section", { ref: root, className: "vx-video-player", "aria-label": title, "data-placement": controlsPlacement, children: [_jsxs6("div", { className: "vx-video-stage", children: [src ? _jsx8("video", { ref: video, src, poster, muted, playsInline: true, preload: "metadata", onDurationChange: (event) => {
|
|
853
|
+
return _jsxs6("section", { ref: root, className: "vx-video-player", "aria-label": title, "data-placement": controlsPlacement, "data-state": state, children: [_jsxs6("div", { className: "vx-video-stage", children: [src ? _jsx8("video", { ref: video, src, poster, muted, playsInline: true, preload: "metadata", onDurationChange: (event) => {
|
|
589
854
|
const value = event.currentTarget.duration;
|
|
590
855
|
setMetadataDuration(Number.isFinite(value) ? value : 0);
|
|
591
856
|
}, onPlay: () => changeState("playing"), onPause: (event) => {
|
|
592
857
|
updateTime(event.currentTarget.currentTime);
|
|
593
858
|
changeState("paused");
|
|
594
|
-
}, onTimeUpdate: (event) => updateTime(event.currentTarget.currentTime), onEnded, onError: (event) => onError?.(event.currentTarget.error) }) : poster && _jsx8("img", { src: poster, alt: "" }), overlay, state === "cover" && _jsxs6("div", { className: "vx-video-cover", children: [_jsxs6("div", { children: [_jsx8("strong", { children: title }), version && _jsx8(Tag, { children: version }), sceneLabel && _jsx8(
|
|
859
|
+
}, onTimeUpdate: (event) => updateTime(event.currentTarget.currentTime), onEnded, onError: (event) => onError?.(event.currentTarget.error) }) : poster && _jsx8("img", { src: poster, alt: "" }), overlay, state === "cover" && _jsxs6("div", { className: "vx-video-cover", children: [_jsxs6("div", { className: "vx-video-info", children: [_jsxs6("div", { className: "vx-video-title", children: [_jsx8("strong", { title, children: title }), version && _jsx8(Tag, { children: version })] }), (durationLabel || sceneLabel) && _jsxs6("div", { className: "vx-video-meta", children: [durationLabel && _jsx8("span", { children: durationLabel }), durationLabel && sceneLabel && _jsx8("span", { "aria-hidden": "true", children: "\xB7" }), sceneLabel && _jsx8("span", { children: sceneLabel })] })] }), (src || duration > 0) && _jsx8(IconButton, { icon: "play-cover", className: "vx-video-start", label: `Play ${title}`, variant: "icon-circle-lg", onClick: togglePlay })] })] }), _jsx8(PlaybackControls, { playing: state === "playing", muted, time: Math.min(time, duration), duration, disabled: !src && !duration, size: controlsSize, onTogglePlay: togglePlay, onToggleMute: () => setMuted(!muted), onSeek: seek, onFullscreen: showFullscreen ? () => void toggleFullscreen() : void 0 })] });
|
|
595
860
|
}
|
|
596
861
|
|
|
597
862
|
// packages/media-tools/src/ui/recipe-player.tsx
|
|
@@ -985,6 +1250,23 @@ function VideoEditor({ input, mode, onApply, onClose }) {
|
|
|
985
1250
|
const [ratio, setRatio] = React4.useState("Freeform");
|
|
986
1251
|
const [error, setError] = React4.useState("");
|
|
987
1252
|
const [saving, setSaving] = React4.useState(false);
|
|
1253
|
+
const focusCancel = React4.useCallback((button) => {
|
|
1254
|
+
if (!button) return;
|
|
1255
|
+
let opener;
|
|
1256
|
+
queueMicrotask(() => {
|
|
1257
|
+
const frame = button.ownerDocument.activeElement;
|
|
1258
|
+
if (button.closest("dialog")?.open && frame?.tagName === "IFRAME") {
|
|
1259
|
+
opener = frame.contentDocument?.activeElement;
|
|
1260
|
+
button.focus({ preventScroll: true });
|
|
1261
|
+
}
|
|
1262
|
+
});
|
|
1263
|
+
return () => {
|
|
1264
|
+
const target = opener;
|
|
1265
|
+
target?.ownerDocument.defaultView?.requestAnimationFrame(() => {
|
|
1266
|
+
if (target.isConnected) target.focus({ preventScroll: true });
|
|
1267
|
+
});
|
|
1268
|
+
};
|
|
1269
|
+
}, []);
|
|
988
1270
|
const [reload, setReload] = React4.useState(0);
|
|
989
1271
|
const generation = React4.useRef(0);
|
|
990
1272
|
const edit = React4.useRef(null);
|
|
@@ -1118,6 +1400,7 @@ function VideoEditor({ input, mode, onApply, onClose }) {
|
|
|
1118
1400
|
), /* @__PURE__ */ React4.createElement("div", { className: "mt-editor-confirm" }, /* @__PURE__ */ React4.createElement(
|
|
1119
1401
|
Button,
|
|
1120
1402
|
{
|
|
1403
|
+
ref: focusCancel,
|
|
1121
1404
|
label: "Cancel",
|
|
1122
1405
|
variant: "text-tonal-md",
|
|
1123
1406
|
width: "hug",
|
|
@@ -1136,7 +1419,7 @@ function VideoEditor({ input, mode, onApply, onClose }) {
|
|
|
1136
1419
|
}
|
|
1137
1420
|
)))
|
|
1138
1421
|
},
|
|
1139
|
-
video && draft ? /* @__PURE__ */ React4.createElement("div", {
|
|
1422
|
+
video && draft ? /* @__PURE__ */ React4.createElement("div", { className: "mt-editor-content", inert: saving, "aria-busy": saving }, /* @__PURE__ */ React4.createElement(
|
|
1140
1423
|
RecipePlayer,
|
|
1141
1424
|
{
|
|
1142
1425
|
video,
|
|
@@ -1169,27 +1452,7 @@ function VideoEditor({ input, mode, onApply, onClose }) {
|
|
|
1169
1452
|
}
|
|
1170
1453
|
})
|
|
1171
1454
|
}
|
|
1172
|
-
), filmstrip?.error && /* @__PURE__ */ React4.createElement("p", { className: "mt-help", role: "status" }, filmstrip.error), /* @__PURE__ */ React4.createElement("
|
|
1173
|
-
"input",
|
|
1174
|
-
{
|
|
1175
|
-
type: "number",
|
|
1176
|
-
min: "0",
|
|
1177
|
-
max: video.durationMs / 1e3,
|
|
1178
|
-
step: "0.001",
|
|
1179
|
-
value: draft.trim[edge] / 1e3,
|
|
1180
|
-
disabled: saving,
|
|
1181
|
-
onChange: (event) => {
|
|
1182
|
-
if (Number.isFinite(event.currentTarget.valueAsNumber))
|
|
1183
|
-
change({
|
|
1184
|
-
...draft,
|
|
1185
|
-
trim: {
|
|
1186
|
-
...draft.trim,
|
|
1187
|
-
[edge]: Math.round(event.currentTarget.valueAsNumber * 1e3)
|
|
1188
|
-
}
|
|
1189
|
-
});
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
)))))) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("div", { className: "mt-editor-hint" }, /* @__PURE__ */ React4.createElement("span", null, "Drag the frame to move. Drag a corner to resize."), /* @__PURE__ */ React4.createElement("span", { role: "status" }, rect?.width, " \xD7 ", rect?.height)), /* @__PURE__ */ React4.createElement(
|
|
1455
|
+
), filmstrip?.error && /* @__PURE__ */ React4.createElement("p", { className: "mt-help", role: "status" }, filmstrip.error)) : /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement("div", { className: "mt-editor-hint" }, /* @__PURE__ */ React4.createElement("span", null, "Drag the frame to move. Drag a corner to resize."), /* @__PURE__ */ React4.createElement("span", { role: "status" }, rect?.width, " \xD7 ", rect?.height)), /* @__PURE__ */ React4.createElement(
|
|
1193
1456
|
SegmentedControl,
|
|
1194
1457
|
{
|
|
1195
1458
|
label: "Aspect ratio",
|
|
@@ -1199,7 +1462,7 @@ function VideoEditor({ input, mode, onApply, onClose }) {
|
|
|
1199
1462
|
size: "large",
|
|
1200
1463
|
width: "full"
|
|
1201
1464
|
}
|
|
1202
|
-
))) : !error && /* @__PURE__ */ React4.createElement("p", { role: "status" }, "Loading fixed video\u2026"),
|
|
1465
|
+
)), video.colorInterpretation === "assumed-bt709" && /* @__PURE__ */ React4.createElement("p", { className: "mt-help", role: "status" }, "Color information is missing. Standard SDR colors are assumed; export may differ slightly.")) : !error && /* @__PURE__ */ React4.createElement("p", { role: "status" }, "Loading fixed video\u2026"),
|
|
1203
1466
|
error && /* @__PURE__ */ React4.createElement("div", { role: "alert", className: "mt-error" }, error, !video && /* @__PURE__ */ React4.createElement(
|
|
1204
1467
|
Button,
|
|
1205
1468
|
{
|
|
@@ -1234,6 +1497,7 @@ function Candidate({
|
|
|
1234
1497
|
const [video, setVideo] = React5.useState(null);
|
|
1235
1498
|
const [error, setError] = React5.useState("");
|
|
1236
1499
|
const [revision, setRevision] = React5.useState(0);
|
|
1500
|
+
const title = slot.context?.shotName?.trim() || video?.name || "Video";
|
|
1237
1501
|
const identity = JSON.stringify(slot.input);
|
|
1238
1502
|
React5.useEffect(() => {
|
|
1239
1503
|
let active = true;
|
|
@@ -1269,11 +1533,11 @@ function Candidate({
|
|
|
1269
1533
|
VideoPlayer,
|
|
1270
1534
|
{
|
|
1271
1535
|
src: video.previewUrl,
|
|
1272
|
-
title
|
|
1273
|
-
controlsPlacement: "
|
|
1536
|
+
title,
|
|
1537
|
+
controlsPlacement: "overlay",
|
|
1274
1538
|
onError: () => setError("This video could not be played. Reload its fixed preview.")
|
|
1275
1539
|
}
|
|
1276
|
-
)), /* @__PURE__ */ React5.createElement("div", { className: "mt-candidate-caption" }, /* @__PURE__ */ React5.createElement("div", { className: "mt-candidate-heading" }, /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement("strong", null, slot.input ?
|
|
1540
|
+
)), /* @__PURE__ */ React5.createElement("div", { className: "mt-candidate-caption" }, /* @__PURE__ */ React5.createElement("div", { className: "mt-candidate-heading" }, /* @__PURE__ */ React5.createElement("div", null, /* @__PURE__ */ React5.createElement("strong", null, slot.input ? title : "Candidate"), video && /* @__PURE__ */ React5.createElement("span", null, "Variant ", video.versionNumber, video.edited ? " \xB7 Edited" : "")), menu), video?.colorInterpretation === "assumed-bt709" && /* @__PURE__ */ React5.createElement("span", null, "Color information is missing. Standard SDR colors are assumed; export may differ slightly.")), /* @__PURE__ */ React5.createElement("div", { className: "mt-candidate-context" }, slot.input && (video || slot.context?.spokenLine || slot.context?.hook || slot.context?.cta) && /* @__PURE__ */ React5.createElement("dl", null, slot.context?.spokenLine && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("dt", null, "Spoken line"), /* @__PURE__ */ React5.createElement("dd", null, slot.context.spokenLine)), slot.context?.hook && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("dt", null, "Opening Hook"), /* @__PURE__ */ React5.createElement("dd", null, slot.context.hook)), slot.context && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("dt", null, "CTA"), /* @__PURE__ */ React5.createElement("dd", null, slot.context.cta || "None")), video && /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement("dt", null, "Format"), /* @__PURE__ */ React5.createElement("dd", null, formatLabel(video.geometry.pixelRect.width, video.geometry.pixelRect.height)), /* @__PURE__ */ React5.createElement("dt", null, "Duration"), /* @__PURE__ */ React5.createElement("dd", null, Number((video.effectiveDurationMs / 1e3).toFixed(2)), "s")))));
|
|
1277
1541
|
}
|
|
1278
1542
|
function VideoCompare(props) {
|
|
1279
1543
|
const [generation, setGeneration] = React5.useState(0);
|
|
@@ -1322,16 +1586,7 @@ function VideoCompare(props) {
|
|
|
1322
1586
|
)
|
|
1323
1587
|
}));
|
|
1324
1588
|
}
|
|
1325
|
-
return /* @__PURE__ */ React5.createElement("section", { className: "mt-compare", "aria-label": "Compare videos" }, /* @__PURE__ */ React5.createElement("
|
|
1326
|
-
Button,
|
|
1327
|
-
{
|
|
1328
|
-
label: "Add column",
|
|
1329
|
-
width: "hug",
|
|
1330
|
-
variant: "text-tonal-sm",
|
|
1331
|
-
disabled: props.slots.length >= 4,
|
|
1332
|
-
onClick: () => props.onSlotsChange([...props.slots, { id: crypto.randomUUID(), input: null }])
|
|
1333
|
-
}
|
|
1334
|
-
)), error && /* @__PURE__ */ React5.createElement("p", { role: "alert", className: "mt-error" }, error), /* @__PURE__ */ React5.createElement(
|
|
1589
|
+
return /* @__PURE__ */ React5.createElement("section", { className: "mt-compare", "aria-label": "Compare videos" }, error && /* @__PURE__ */ React5.createElement("p", { role: "alert", className: "mt-error" }, error), /* @__PURE__ */ React5.createElement(
|
|
1335
1590
|
"div",
|
|
1336
1591
|
{
|
|
1337
1592
|
className: "mt-compare-columns",
|
|
@@ -1345,13 +1600,14 @@ function VideoCompare(props) {
|
|
|
1345
1600
|
replacing: replacing === slot.id,
|
|
1346
1601
|
onChoose: () => void replace(slot),
|
|
1347
1602
|
emptyState: props.candidates ? candidateChoices(slot).length ? /* @__PURE__ */ React5.createElement(Menu, { label: "Choose video", floating: true, items: candidateChoices(slot) }) : /* @__PURE__ */ React5.createElement("p", null, "No other candidates yet.") : void 0,
|
|
1348
|
-
menu:
|
|
1603
|
+
menu: /* @__PURE__ */ React5.createElement(
|
|
1349
1604
|
Menu,
|
|
1350
1605
|
{
|
|
1351
1606
|
label: `Options for video ${index + 1}`,
|
|
1352
1607
|
triggerIcon: "more",
|
|
1353
1608
|
floating: true,
|
|
1354
1609
|
items: [
|
|
1610
|
+
...props.slotMenuItems?.(slot) ?? [],
|
|
1355
1611
|
...props.candidates ? [
|
|
1356
1612
|
{
|
|
1357
1613
|
id: "replace",
|
|
@@ -1380,6 +1636,15 @@ function VideoCompare(props) {
|
|
|
1380
1636
|
}
|
|
1381
1637
|
}
|
|
1382
1638
|
] : [],
|
|
1639
|
+
{
|
|
1640
|
+
id: "add-column",
|
|
1641
|
+
label: "Add column",
|
|
1642
|
+
disabled: props.slots.length >= 4,
|
|
1643
|
+
onSelect: () => props.onSlotsChange([
|
|
1644
|
+
...props.slots,
|
|
1645
|
+
{ id: crypto.randomUUID(), input: null }
|
|
1646
|
+
])
|
|
1647
|
+
},
|
|
1383
1648
|
{ id: "remove", label: "Remove", onSelect: () => remove(slot) }
|
|
1384
1649
|
]
|
|
1385
1650
|
}
|