@vivix-labs/media-tools 1.0.0-beta.20 → 1.0.0-beta.21
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/client.bundle.js +75 -12
- package/dist/server.d.ts +1 -0
- package/dist/server.js +1288 -278
- package/dist/shared.d.ts +330 -5
- package/dist/shared.js +144 -4
- package/package.json +1 -1
- package/studio-plugin.json +1 -1
package/dist/client.bundle.js
CHANGED
|
@@ -49,7 +49,7 @@ function exportName(name, extension) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// packages/media-tools/src/shared.ts
|
|
52
|
-
import { z, PluginError } from "vivix-studio/sdk/shared";
|
|
52
|
+
import { z, PluginError, studioFileRef } from "vivix-studio/sdk/shared";
|
|
53
53
|
var Config = z.object({
|
|
54
54
|
dataInstance: z.string().min(1).default("user:data"),
|
|
55
55
|
studioInstance: z.string().min(1).default("studio"),
|
|
@@ -136,7 +136,66 @@ var saveEdit = z.object({
|
|
|
136
136
|
c.addIssue({ code: "custom", message: "An edit update requires its revision." });
|
|
137
137
|
});
|
|
138
138
|
var outputName = z.string().trim().min(1).max(200);
|
|
139
|
-
var
|
|
139
|
+
var gain = z.number().finite().min(-96).max(24);
|
|
140
|
+
var milliseconds = z.number().int().min(0).max(6e5);
|
|
141
|
+
var audioMix = z.object({
|
|
142
|
+
version: z.literal(1),
|
|
143
|
+
originalGainDb: gain.nullable().optional(),
|
|
144
|
+
originals: z.array(
|
|
145
|
+
z.object({
|
|
146
|
+
inputIndex: z.number().int().min(0).max(63),
|
|
147
|
+
gainDb: gain.nullable(),
|
|
148
|
+
role: z.enum(["dialogue", "ambience"]).optional()
|
|
149
|
+
}).strict()
|
|
150
|
+
).max(64).optional(),
|
|
151
|
+
tracks: z.array(
|
|
152
|
+
z.object({
|
|
153
|
+
id: z.string().trim().min(1).max(128),
|
|
154
|
+
file: videoFileRef,
|
|
155
|
+
role: z.enum(["narration", "music", "sfx"]),
|
|
156
|
+
atMs: milliseconds,
|
|
157
|
+
inMs: milliseconds.optional(),
|
|
158
|
+
outMs: milliseconds.optional(),
|
|
159
|
+
gainDb: gain.optional(),
|
|
160
|
+
fadeInMs: milliseconds.optional(),
|
|
161
|
+
fadeOutMs: milliseconds.optional()
|
|
162
|
+
}).strict()
|
|
163
|
+
).max(32),
|
|
164
|
+
ducking: z.boolean().optional(),
|
|
165
|
+
loudness: z.enum(["studio-web-v1", "off"]).optional()
|
|
166
|
+
}).strict();
|
|
167
|
+
var maxSequenceInputs = 64;
|
|
168
|
+
var audioQuery = z.object({ inputs: z.array(sequenceVideoInput).min(1).max(maxSequenceInputs) }).strict();
|
|
169
|
+
var previewQuery = audioQuery.extend({
|
|
170
|
+
knownRevision: z.number().int().nonnegative().optional()
|
|
171
|
+
});
|
|
172
|
+
var audioPreviewResult = z.discriminatedUnion("state", [
|
|
173
|
+
z.object({ state: z.literal("original"), revision: z.number() }),
|
|
174
|
+
z.object({ state: z.literal("unchanged") }),
|
|
175
|
+
z.object({ state: z.literal("preparing") }),
|
|
176
|
+
z.object({
|
|
177
|
+
state: z.literal("ready"),
|
|
178
|
+
revision: z.number(),
|
|
179
|
+
file: studioFileRef().nullable(),
|
|
180
|
+
segments: z.array(z.object({ startMs: z.number(), durationMs: z.number().positive() }))
|
|
181
|
+
})
|
|
182
|
+
]);
|
|
183
|
+
var saveAudio = audioQuery.extend({
|
|
184
|
+
expectedRevision: z.number().int().nonnegative(),
|
|
185
|
+
mix: audioMix.nullable()
|
|
186
|
+
});
|
|
187
|
+
var remixRequest = z.object({
|
|
188
|
+
basis: z.enum(["sources", "master"]),
|
|
189
|
+
mix: audioMix,
|
|
190
|
+
expectedAssetRevision: z.number().int().positive(),
|
|
191
|
+
expectedMixRevision: z.number().int().nonnegative()
|
|
192
|
+
}).strict();
|
|
193
|
+
var processVideo = z.object({
|
|
194
|
+
input: videoInput,
|
|
195
|
+
outputName,
|
|
196
|
+
retryOfJobId: z.uuid().optional(),
|
|
197
|
+
remix: remixRequest.optional()
|
|
198
|
+
}).strict().refine((v) => !v.remix || v.input.kind === "source", "Remix requires a fixed source file.");
|
|
140
199
|
var canvas = z.object({ width: z.number().int().min(2).max(3840), height: z.number().int().min(2).max(3840) }).strict().refine(
|
|
141
200
|
(v) => v.width % 2 === 0 && v.height % 2 === 0 && Math.min(v.width, v.height) <= 2160,
|
|
142
201
|
"Canvas dimensions must be even and within 3840 by 2160."
|
|
@@ -166,7 +225,7 @@ var exportSettings = z.object({
|
|
|
166
225
|
audio: z.boolean()
|
|
167
226
|
}).strict();
|
|
168
227
|
var processSequence = z.object({
|
|
169
|
-
inputs: z.array(sequenceVideoInput).min(1).max(
|
|
228
|
+
inputs: z.array(sequenceVideoInput).min(1).max(maxSequenceInputs),
|
|
170
229
|
outputName,
|
|
171
230
|
canvas,
|
|
172
231
|
settings: exportSettings.optional(),
|
|
@@ -542,7 +601,7 @@ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
|
542
601
|
function optionIcon(icon) {
|
|
543
602
|
return typeof icon === "string" ? _jsx4(Icon, { name: icon }) : icon;
|
|
544
603
|
}
|
|
545
|
-
function Dropdown({ label, options, value, onValueChange, placeholder = "Select an option", size = "medium", width = "fixed", appearance = "default", textSize = 14, floating = false, disabled = false }) {
|
|
604
|
+
function Dropdown({ label, options, value, onValueChange, onReselect, placeholder = "Select an option", size = "medium", width = "fixed", appearance = "default", textSize = 14, floating = false, disabled = false }) {
|
|
546
605
|
const id = useId();
|
|
547
606
|
const trigger = useRef(null);
|
|
548
607
|
const list = useRef(null);
|
|
@@ -608,8 +667,12 @@ function Dropdown({ label, options, value, onValueChange, placeholder = "Select
|
|
|
608
667
|
}
|
|
609
668
|
function choose(option) {
|
|
610
669
|
close();
|
|
611
|
-
if (option
|
|
670
|
+
if (!option || option.disabled)
|
|
671
|
+
return;
|
|
672
|
+
if (option.value !== value)
|
|
612
673
|
onValueChange(option.value);
|
|
674
|
+
else
|
|
675
|
+
onReselect?.();
|
|
613
676
|
}
|
|
614
677
|
function handleKey(event) {
|
|
615
678
|
if (!canOpen || event.nativeEvent.isComposing)
|
|
@@ -1008,9 +1071,9 @@ function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating =
|
|
|
1008
1071
|
if (!anchor || !menu2)
|
|
1009
1072
|
return;
|
|
1010
1073
|
const document3 = anchor.ownerDocument;
|
|
1011
|
-
const
|
|
1074
|
+
const window3 = document3.defaultView;
|
|
1012
1075
|
const rect = anchor.getBoundingClientRect();
|
|
1013
|
-
const width = document3.documentElement.clientWidth, height =
|
|
1076
|
+
const width = document3.documentElement.clientWidth, height = window3.innerHeight;
|
|
1014
1077
|
const bounds = menu2.getBoundingClientRect();
|
|
1015
1078
|
const naturalHeight = menu2.scrollHeight + bounds.height - menu2.clientHeight;
|
|
1016
1079
|
const below = Math.max(0, height - rect.bottom - 12), above = Math.max(0, rect.top - 12);
|
|
@@ -1052,14 +1115,14 @@ function Menu({ label, items, triggerIcon, textTrigger = "dropdown", floating =
|
|
|
1052
1115
|
setPath(null);
|
|
1053
1116
|
};
|
|
1054
1117
|
const document2 = portalRoot.ownerDocument;
|
|
1055
|
-
const
|
|
1118
|
+
const window2 = document2.defaultView;
|
|
1056
1119
|
position();
|
|
1057
|
-
|
|
1058
|
-
|
|
1120
|
+
window2.addEventListener("resize", position);
|
|
1121
|
+
window2.addEventListener("scroll", position, true);
|
|
1059
1122
|
document2.addEventListener("pointerdown", outside);
|
|
1060
1123
|
return () => {
|
|
1061
|
-
|
|
1062
|
-
|
|
1124
|
+
window2.removeEventListener("resize", position);
|
|
1125
|
+
window2.removeEventListener("scroll", position, true);
|
|
1063
1126
|
document2.removeEventListener("pointerdown", outside);
|
|
1064
1127
|
};
|
|
1065
1128
|
}, [floating, path, portalRoot, cascade]);
|
package/dist/server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ServerContext } from 'vivix-studio/sdk/server';
|
|
|
2
2
|
import { MediaToolsConfig } from './shared.js';
|
|
3
3
|
export { Config } from './shared.js';
|
|
4
4
|
import 'react';
|
|
5
|
+
import 'vivix-studio/sdk/client';
|
|
5
6
|
import 'vivix-studio/sdk/shared';
|
|
6
7
|
import '@vivix-labs/ui-system';
|
|
7
8
|
|