@vivix-labs/ads-workbench 1.0.0-beta.17 → 1.0.0-beta.18

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.
@@ -214,8 +214,8 @@ function Icon({ name, size }) {
214
214
  },
215
215
  ...size === void 0 ? {} : { "--vx-icon-size": `${size}px` }
216
216
  };
217
- if (name === "relationships" || name === "color-adjust" || name === "speed") {
218
- return _jsx2("svg", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: name === "color-adjust" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M3 5h3m4 0h7M3 10h8m4 0h2M3 15h3m4 0h7" }), _jsx2("circle", { cx: "8", cy: "5", r: "2" }), _jsx2("circle", { cx: "13", cy: "10", r: "2" }), _jsx2("circle", { cx: "8", cy: "15", r: "2" })] }) : name === "speed" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M4 16a8 8 0 1 1 12 0M10 3v2M3 10h2m10 0h2M5 5l1.4 1.4M10 12l4-5" }), _jsx2("circle", { cx: "10", cy: "12", r: "1.5" })] }) : _jsxs(_Fragment, { children: [_jsx2("path", { d: "M8.5 6.3 5 11.7M11.5 6.3 15 11.7M6.5 14.5h7" }), _jsx2("circle", { cx: "10", cy: "4", r: "2.5" }), _jsx2("circle", { cx: "4", cy: "14.5", r: "2.5" }), _jsx2("circle", { cx: "16", cy: "14.5", r: "2.5" })] }) });
217
+ if (name === "menu" || name === "relationships" || name === "color-adjust" || name === "speed") {
218
+ return _jsx2("svg", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: name === "menu" ? _jsx2("path", { d: "M3 5h14M3 10h14M3 15h14" }) : name === "color-adjust" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M3 5h3m4 0h7M3 10h8m4 0h2M3 15h3m4 0h7" }), _jsx2("circle", { cx: "8", cy: "5", r: "2" }), _jsx2("circle", { cx: "13", cy: "10", r: "2" }), _jsx2("circle", { cx: "8", cy: "15", r: "2" })] }) : name === "speed" ? _jsxs(_Fragment, { children: [_jsx2("path", { d: "M4 16a8 8 0 1 1 12 0M10 3v2M3 10h2m10 0h2M5 5l1.4 1.4M10 12l4-5" }), _jsx2("circle", { cx: "10", cy: "12", r: "1.5" })] }) : _jsxs(_Fragment, { children: [_jsx2("path", { d: "M8.5 6.3 5 11.7M11.5 6.3 15 11.7M6.5 14.5h7" }), _jsx2("circle", { cx: "10", cy: "4", r: "2.5" }), _jsx2("circle", { cx: "4", cy: "14.5", r: "2.5" }), _jsx2("circle", { cx: "16", cy: "14.5", r: "2.5" })] }) });
219
219
  }
220
220
  return _jsx2("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style });
221
221
  }
@@ -1280,6 +1280,38 @@ function useWorkspaceTheme() {
1280
1280
  return { theme: preference === "system" ? system : preference, preference, update };
1281
1281
  }
1282
1282
 
1283
+ // packages/ui-system/dist/playback-shortcut.js
1284
+ import { useEffect as useEffect9, useRef as useRef12 } from "react";
1285
+ function usePlaybackShortcut(target, toggle, enabled = true) {
1286
+ const latest = useRef12(toggle);
1287
+ latest.current = toggle;
1288
+ useEffect9(() => {
1289
+ const element = target.current;
1290
+ if (!enabled || !element)
1291
+ return;
1292
+ const doc = element.ownerDocument;
1293
+ const tree = element.getRootNode();
1294
+ const onKey = (event2) => {
1295
+ if (event2.code !== "Space" || event2.defaultPrevented || event2.repeat || event2.isComposing || event2.altKey || event2.ctrlKey || event2.metaKey || event2.shiftKey || !element.getClientRects().length || element.closest("[inert], [hidden]"))
1296
+ return;
1297
+ const path = event2.composedPath();
1298
+ const source = path.find((node) => node.nodeType === 1);
1299
+ if (source?.isContentEditable || source?.closest('input, textarea, select, button, a[href], [role="button"], [role="textbox"], [role="slider"], [role="combobox"], [role="menuitem"]'))
1300
+ return;
1301
+ for (const scope of /* @__PURE__ */ new Set([doc, tree])) {
1302
+ if ([...scope.querySelectorAll('dialog[open], [role="dialog"][aria-modal="true"]')].some((dialog) => !dialog.contains(element)))
1303
+ return;
1304
+ }
1305
+ if (doc.fullscreenElement && !doc.fullscreenElement.contains(element) && !element.contains(doc.fullscreenElement))
1306
+ return;
1307
+ event2.preventDefault();
1308
+ latest.current();
1309
+ };
1310
+ doc.addEventListener("keydown", onKey);
1311
+ return () => doc.removeEventListener("keydown", onKey);
1312
+ }, [target, enabled]);
1313
+ }
1314
+
1283
1315
  // packages/ui-system/dist/duration.js
1284
1316
  function formatDurationSeconds(durationMs) {
1285
1317
  return (Math.round(durationMs / 100) / 10).toFixed(1).replace(/\.0$/, "");
@@ -1439,7 +1471,9 @@ var anchor = z2.discriminatedUnion("kind", [
1439
1471
  var generationInput = z2.object({
1440
1472
  targetAssetId: z2.uuid().optional(),
1441
1473
  taskName: z2.string().trim().min(1).max(200).optional(),
1442
- context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).optional(),
1474
+ context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).describe(
1475
+ "Owning-domain binding stored with the task. Short drama passes { episodeId, shotId } so the finished take attaches to that shot; production.generateShot sets it automatically."
1476
+ ).optional(),
1443
1477
  expectedRevision: z2.number().int().positive().optional(),
1444
1478
  newAsset: z2.object({
1445
1479
  name: z2.string().trim().min(1).max(200),
@@ -1478,7 +1512,7 @@ var projectSettingsInput = z2.object({
1478
1512
  var generationSubmitOperation = defineOperation({
1479
1513
  id: "generation.submit",
1480
1514
  title: "Generate",
1481
- description: "Submit one media generation without approval, retaining its paid request identity.",
1515
+ description: "Submit one media generation without approval, retaining its paid request identity. Pass context with the owning domain identifiers; without it the output is only stored in the media library.",
1482
1516
  input: generationInput,
1483
1517
  output: z2.any(),
1484
1518
  effects: ["write", "paid"],
@@ -1660,7 +1694,8 @@ function AdPlayer({
1660
1694
  focusedClip,
1661
1695
  poster,
1662
1696
  onFocus,
1663
- onError
1697
+ onError,
1698
+ keyboardPlayback = false
1664
1699
  }) {
1665
1700
  const video = React2.useRef(null);
1666
1701
  const frame = React2.useRef(null);
@@ -1731,6 +1766,16 @@ function AdPlayer({
1731
1766
  const local = entry?.state === "ready" ? Math.max(0, Math.min(entry.durationMs, sourceTime * 1e3 - entry.recipe.trim.inMs)) / 1e3 : 0;
1732
1767
  const time = sequenceOffset(entries, index) / 1e3 + local;
1733
1768
  const crop = entry?.state === "ready" ? entry.recipe.crop : { x: 0, y: 0, width: 1, height: 1 };
1769
+ function togglePlay() {
1770
+ if (!video.current || entry?.state !== "ready") return;
1771
+ if (playing) video.current.pause();
1772
+ else {
1773
+ if (video.current.currentTime * 1e3 >= entry.recipe.trim.outMs)
1774
+ video.current.currentTime = entry.recipe.trim.inMs / 1e3;
1775
+ void video.current.play().catch((error) => onError(error.message));
1776
+ }
1777
+ }
1778
+ usePlaybackShortcut(frame, togglePlay, keyboardPlayback && entry?.state === "ready");
1734
1779
  return /* @__PURE__ */ React2.createElement("div", { className: "ad-player", ref: frame }, /* @__PURE__ */ React2.createElement("div", { className: "ad-screen" }, entry?.state === "ready" ? /* @__PURE__ */ React2.createElement(
1735
1780
  "div",
1736
1781
  {
@@ -1789,15 +1834,7 @@ function AdPlayer({
1789
1834
  time,
1790
1835
  duration: duration3,
1791
1836
  disabled: entry?.state !== "ready",
1792
- onTogglePlay: () => {
1793
- if (!video.current || entry?.state !== "ready") return;
1794
- if (playing) video.current.pause();
1795
- else {
1796
- if (video.current.currentTime * 1e3 >= entry.recipe.trim.outMs)
1797
- video.current.currentTime = entry.recipe.trim.inMs / 1e3;
1798
- void video.current.play().catch((error) => onError(error.message));
1799
- }
1800
- },
1837
+ onTogglePlay: togglePlay,
1801
1838
  onToggleMute: () => setMuted((value) => !value),
1802
1839
  onSeek: (seconds2) => {
1803
1840
  const next = sequencePosition(entries, seconds2 * 1e3);
@@ -4169,6 +4206,7 @@ function AdsWorkbench({
4169
4206
  ), !loadingProject && (page === "preview" || page === "scene") && /* @__PURE__ */ React8.createElement("div", { className: page === "scene" ? "ad-scene-layout" : "ad-film-layout" }, page === "scene" && /* @__PURE__ */ React8.createElement("section", { className: "ad-panel ad-candidate-panel" }, candidates), /* @__PURE__ */ React8.createElement("section", { className: "ad-film-center" }, /* @__PURE__ */ React8.createElement(
4170
4207
  AdPlayer,
4171
4208
  {
4209
+ keyboardPlayback: page === "preview",
4172
4210
  entries: page === "scene" ? entry ? [entry] : [] : sequence?.entries || [],
4173
4211
  focusedClip: selectedClip,
4174
4212
  poster: posterURL || void 0,
package/dist/server.js CHANGED
@@ -111,7 +111,9 @@ var anchor = z2.discriminatedUnion("kind", [
111
111
  var generationInput = z2.object({
112
112
  targetAssetId: z2.uuid().optional(),
113
113
  taskName: z2.string().trim().min(1).max(200).optional(),
114
- context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).optional(),
114
+ context: z2.record(z2.string().min(1).max(64), z2.string().min(1).max(200)).describe(
115
+ "Owning-domain binding stored with the task. Short drama passes { episodeId, shotId } so the finished take attaches to that shot; production.generateShot sets it automatically."
116
+ ).optional(),
115
117
  expectedRevision: z2.number().int().positive().optional(),
116
118
  newAsset: z2.object({
117
119
  name: z2.string().trim().min(1).max(200),
@@ -150,7 +152,7 @@ var projectSettingsInput = z2.object({
150
152
  var generationSubmitOperation = defineOperation({
151
153
  id: "generation.submit",
152
154
  title: "Generate",
153
- description: "Submit one media generation without approval, retaining its paid request identity.",
155
+ description: "Submit one media generation without approval, retaining its paid request identity. Pass context with the owning domain identifiers; without it the output is only stored in the media library.",
154
156
  input: generationInput,
155
157
  output: z2.any(),
156
158
  effects: ["write", "paid"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vivix-labs/ads-workbench",
3
- "version": "1.0.0-beta.17",
3
+ "version": "1.0.0-beta.18",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -39,8 +39,8 @@
39
39
  "react-dom": "^19.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@vivix-labs/project-studio": "1.0.0-beta.17",
43
- "@vivix-labs/ui-system": "1.0.0-beta.17"
42
+ "@vivix-labs/ui-system": "1.0.0-beta.20",
43
+ "@vivix-labs/project-studio": "1.0.0-beta.18"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "node ../../scripts/build-product-packages.mjs ads-workbench"